ref: 5bba44eae97153d0cc3ee5a08d014c9a38a850e4
parent: 792407e805ebd3cbbe140886b5e72a9193a22e1f
author: sirjofri <sirjofri@sirjofri.de>
date: Sun Nov 21 16:15:51 EST 2021
adds rudimentary parsing of messages (sender from chat)
--- a/gridirc.rc
+++ b/gridirc.rc
@@ -24,9 +24,30 @@
exit
}
+fn parsed{
+echo $* | awk 'NF >= 3 {
+ chan=ENVIRON["currentchannel"]
+ if (length($2) == 1){
+ sender=$1
+ $1=""
+ $2=""
+ sub(/^ +/, "")
+ printf ":%s PRIVMSG #%s :%s\n", sender, chan, $0
+ } else {
+ printf ":%s PRIVMSG #%s :%s\n", chan, chan, $0
+ }
+ next
+}
+{
+ printf ":%s PRIVMSG #%s :%s\n", chan, chan, $0
+}'
+}
+
fn loopread{
+currentchannel=$1
while(c=`{read})
- echo :$1 PRIVMSG '#'$1 :$"c
+ parsed $c
+ #echo :$1 PRIVMSG '#'$1 :$"c
}
fn startread{