This commit is contained in:
Neale Pickett 2011-01-28 14:09:55 -06:00
parent ecb62e614e
commit 6a272b0b86
2 changed files with 16 additions and 3 deletions

4
bot
View File

@ -9,4 +9,6 @@ nickname=$1; export nickname
echo "USER $1 $1 $1 :I'm a little printf, short and stdout."
)
exec ./dispatch ./irc ./$1-handler
mkfifo -m 0600 $1.fifo
exec ./dispatch -f $1.fifo ./irc ./$1-handler

View File

@ -19,6 +19,8 @@ join () {
raw "JOIN $1"
}
out=$(tempfile)
case $command in
001)
for chan in ${CHANNELS:-#cobalt}; do
@ -42,7 +44,14 @@ case $command in
join "$forum"
raw "PRIVMSG %s :Thanks for the invitation, %s." "$forum" "$sender"
;;
esac | while read -r line; do
esac > $out
if [ "$forum" != "$sender" ] && [ $(wc -l < $out) -gt 5 ]; then
printf "PRIVMSG %s :Too many lines, sending privately.\r\n" "$forum"
forum=$sender
fi
while read -r line; do
case "$line" in
*)
printf "%s\r\n" "${line#}"
@ -51,5 +60,7 @@ esac | while read -r line; do
printf "PRIVMSG %s :%s\r\n" "$forum" "$line"
;;
esac
done
done < $out
rm -f $out