diff --git a/bot b/bot index 491bb9e..5565802 100755 --- a/bot +++ b/bot @@ -19,6 +19,6 @@ export nickname realname fi ) -mkfifo -m 0600 $botdir/fifo +[ -p $botdir/fifo ] || mkfifo -m 0600 $botdir/fifo exec $d/dispatch -f $botdir/fifo $d/irc $botdir/handler diff --git a/connect-handler b/connect-handler index ecbe8e8..c909696 100755 --- a/connect-handler +++ b/connect-handler @@ -11,7 +11,15 @@ else fd=1 fi -$botdir/login 1>& $fd +if [ -x $botdir/login ]; then + $botdir/login 1 >& $fd +else + nickname=$(cat $botdir/nickname) + realname=$(cat $botdir/realname 2>/dev/null || \ + echo "I'm a little printf, short and stdout.") + echo "NICK $nickname" 1 >& $fd + echo "USER $nickname $nickname $nickname :$realname" 1 >& $fd +fi if [ -p $botdir/fifo ]; then fifo="-f $botdir/fifo" diff --git a/irc-filter.c b/irc-filter.c index d297460..ecfb4d8 100644 --- a/irc-filter.c +++ b/irc-filter.c @@ -111,7 +111,8 @@ main(int argc, char *argv[]) (0 == strcmp(cmd, "KICK"))) { forum = parts[1]; } else if (0 == strcmp(cmd, "JOIN")) { - if (0 == nparts) { + DUMP_d(nparts); + if (1 == nparts) { forum = text; text = NULL; } else {