irc-bot/connect-handler

29 lines
599 B
Plaintext
Raw Normal View History

2011-06-09 21:27:24 -06:00
#! /bin/sh -e
botdir=$1
ircdir=$(dirname $0)
export botdir ircdir
# UCSPI wants communication on fd7
if [ -n "$PROTO" ]; then
fd=7
else
fd=1
fi
2012-08-23 12:57:17 -06:00
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
2011-06-09 21:27:24 -06:00
if [ -p $botdir/fifo ]; then
fifo="-f $botdir/fifo"
fi
2012-01-06 16:14:45 -07:00
exec $ircdir/dispatch $fifo $ircdir/irc-filter $botdir/handler