5 server=irc.freenode.net
9 clonefile=/net/tcp/clone
20 echo QUIT : Leaving... > $netdir/data
29 date | awk '{print $4}' | awk -F ':' '{print "[" $1 ":" $2 "]"}'
33 echo USER $user foo bar :$realname > $netdir/data
34 echo NICK $nick > $netdir/data
36 echo PRIVMSG 'nickserv :'identify $"pass > $netdir/data
39 echo JOIN $target > $netdir/data
42 target = `{echo $target | awk -F',' '{print $NF}'}
46 if(! ~ `{cat $netdir/status} *Established*)
49 echo QUIT : Leaving... > $netdir/data
56 eval `{mshift $cmd} | while(rc=`{read})echo 'PRIVMSG '^$target^' :' $rc | tee $netdir/data
58 msg = (MODE `{mshift $cmd})
62 msg = (NOTICE $cmd(1) : `{mshift $cmd})
64 msg = (TOPIC `{mshift $cmd})
66 msg = (WHOIS `{mshift $cmd})
68 msg = (AWAY : `{mshift $cmd})
73 msg = (JOIN `{mshift $cmd})
75 target = `{echo $target | awk -F',' '{print $NF}'}
78 msg = (LIST `{mshift $cmd})
84 out = '('^$to^') ⇐ '^$"cmd
85 msg = 'PRIVMSG '^$to^' :'^$"cmd
93 msg = (PART $cmd(1) : `{mshift $cmd})
97 target = `{mshift $cmd}
100 msg = (USERS `{mshift $cmd})
102 msg = (WHO `{mshift $cmd})
104 echo QUIT : Leaving... > $netdir/data
109 msg = 'PRIVMSG '^$target^' :'^$"cmd
110 out = '('^$target^') ⇐ '^$"cmd
113 echo $msg > $netdir/data
115 echo `{etime}^' '^$out
122 s/!~?[a-zA-Z0-9_@\-|.{=\/:]+ /:/' |
125 s = $2 " «" $1 "»\t" $3;
126 for(i = 4; i < NF+1; i++)
134 s/^NOTICE /:'^$server^':/
136 s/!~?[a-zA-Z0-9_@\-|.{=\/]+ /:/' |
139 s = "-" $1 "- ⇒\t" $3;
140 for(i = 4; i < NF+1; i++)
147 sed 's/^:[a-zA-Z0-9_@\-|.!=#]+ //
149 s/^353= /*** Users on /
150 s/^[0-9][0-9][0-9] ?:?/*** /'
156 s/!~?[a-zA-Z0-9_@\-|.{=\/:]+ PRIVMSG /» ⇒ :/
157 s/#[a-zA-Z0-9_@\-|.#]+/(&)/' |
161 for(i = 4; i < NF+1; i++)
168 while (~ `{cat $netdir/status} *Established*) {
176 line = `{echo -n $line | privmsg}
177 case *JOIN* *QUIT* *PART* *NICK*
178 line = `{echo -n $line | misc}
180 line = `{echo -n $line | notice}
182 echo -n $line | sed 's/PING/PONG/' > $netdir/data
185 line = `{echo -n $line | numeric}
194 echo $1 ip | ndb/dnsquery | sed 1q | awk '{print $NF}'
199 if (test -f /mnt/acme/$winid/ctl)
200 echo name /$server/$target/-ircrc > /mnt/acme/$winid/ctl
203 label $target@$server
221 echo 'usage: ircrc [-p port] [-r realname] [-t target] [-n nick] [server]' >[1=2]
230 server=im.bitlbee.org
240 echo cant translate $server
245 userpass=`{auth/userpasswd 'server='^$server^' service=irc user='^$nick >[2]/dev/null}
246 if(~ $#userpass 2 && ~ $nick $user) {
252 netdir=`{basename -d $clonefile} ^ / ^ `{cat /fd/4}
253 echo connect $ip!$port >$netdir/ctl || exit 'cannot connect'
254 echo connected to tcp!$ip!$port on $netdir
255 cat $netdir/data | tr -d '\x2\xd\x1f' | pretty &