ref: 4eb9f74514b3f23b3c842dccc41d9545215a059b
parent: 03b0e38598d056291e215d6be8ce8eb1fc337bd8
author: noodle <noodle@pastanoggin.com>
date: Tue Dec 2 17:48:43 EST 2025
ircrc: don't print if user message is empty and set target to '' if it's null If the user sends an empty message, prevent setting "out" and let the server return an error. if the user sends a /t command without arguments, set "target" to a '' if it's null to avoid rc error "null list in concatenation." Don't let /N or /m take only one argument as it's invalid, and allow /j to take a 2nd argument for an optional channel keys list
--- a/rc/bin/ircrc
+++ b/rc/bin/ircrc
@@ -58,7 +58,7 @@
msg = (MODE `{mshift $cmd})case /N
cmd = `{mshift $cmd}- if (! ~ $#cmd 0)
+ if (! ~ $#cmd 0 1)
msg = (NOTICE $cmd(1) : `{mshift $cmd})case /T
msg = (TOPIC `{mshift $cmd})@@ -65,9 +65,9 @@
case /W
msg = (WHOIS `{mshift $cmd})case /a
- msg = (AWAY : `{mshift $cmd})+ msg = (AWAY : `{mshift $cmd})case /j
- if (~ $#cmd 2) {+ if (~ $#cmd 2 3) {target=$cmd(2)
title
msg = (JOIN `{mshift $cmd})@@ -78,23 +78,24 @@
msg = (LIST `{mshift $cmd})case /m
cmd = `{mshift $cmd}- if (! ~ $#cmd 0) {+ if (! ~ $#cmd 0 1) {to = $cmd(1)
cmd = `{mshift $cmd} out = '('^$to^') ⇐ '^$"cmd- msg = 'PRIVMSG '^$to^' :'^$"cmd
+ msg = (PRIVMSG $to :^$"cmd)
}
case /n
nick = `{mshift $cmd}- msg = (NICK $nick)
+ msg = (NICK $nick)
case /p
cmd = `{mshift $cmd}if (! ~ $#cmd 0)
msg = (PART $cmd(1) : `{mshift $cmd})case /q
- msg = `{mshift $cmd}+ msg = `{mshift $cmd}case /t
- target = `{mshift $cmd}+ cmd = $cmd(2)
+ target = $"cmd
title
case /u
msg = (USERS `{mshift $cmd})@@ -106,13 +107,14 @@
case /*
echo unknown command >/dev/cons
case *
- msg = 'PRIVMSG '^$target^' :'^$"cmd
- out = '('^$target^') ⇐ '^$"cmd+ msg = (PRIVMSG $target :^$"cmd)
+ if (! ~ $#cmd 0)
+ out = '('^$target^') ⇐ '^$"cmd}
if (! ~ $#msg 0)
echo $msg
if (! ~ $#out 0)
- echo `{etime}^' '^$out >/dev/cons+ echo `{etime} $out >/dev/cons}
}
--
⑨