diff --git a/Makefile b/Makefile index d2cc6a3..852645c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CFLAGS = -Wall -Werror -TARGETS = dispatch irc +TARGETS = dispatch irc-filter all: $(TARGETS) diff --git a/connect-handler b/connect-handler index a58fbf9..ecbe8e8 100755 --- a/connect-handler +++ b/connect-handler @@ -17,4 +17,4 @@ if [ -p $botdir/fifo ]; then fifo="-f $botdir/fifo" fi -exec $ircdir/dispatch $fifo $ircdir/irc $botdir/handler +exec $ircdir/dispatch $fifo $ircdir/irc-filter $botdir/handler diff --git a/irc.c b/irc-filter.c similarity index 87% rename from irc.c rename to irc-filter.c index 6601253..d297460 100644 --- a/irc.c +++ b/irc-filter.c @@ -92,11 +92,23 @@ main(int argc, char *argv[]) /* Determine forum */ if ((0 == strcmp(cmd, "PRIVMSG")) || - (0 == strcmp(cmd, "NOTICE")) || - (0 == strcmp(cmd, "PART")) || - (0 == strcmp(cmd, "MODE")) || - (0 == strcmp(cmd, "TOPIC")) || - (0 == strcmp(cmd, "KICK"))) { + (0 == strcmp(cmd, "NOTICE"))) { + /* :neale!user@127.0.0.1 PRIVMSG #hydra :foo */ + switch (parts[1][0]) { + case '#': + case '&': + case '+': + case '!': + forum = parts[1]; + break; + default: + forum = snick; + break; + } + } else if ((0 == strcmp(cmd, "PART")) || + (0 == strcmp(cmd, "MODE")) || + (0 == strcmp(cmd, "TOPIC")) || + (0 == strcmp(cmd, "KICK"))) { forum = parts[1]; } else if (0 == strcmp(cmd, "JOIN")) { if (0 == nparts) {