# HG changeset patch # User Markus Bröker # Date 1265111452 -3600 # Node ID 5b7e8dba46a02c9ca864ad84e3031225b4b9cb89 # Parent 0ae006af497e659d81063833a271e895d7de84a1 Topic command added The bot can change the topic on the fly right now committer: Markus Bröker diff --git a/src/parse.c b/src/parse.c --- a/src/parse.c +++ b/src/parse.c @@ -26,7 +26,8 @@ enum command_map { HELP, JOIN, LEAVE, ADD, REPLACE, DELETE, LIST, SEARCH, INFO, PING, ON, OFF, DEBUG, - VACCUUM, LOGOUT, WHO, WHOIS, TIME, TELL, OP, DEOP, KICK, BAN, UNBAN, KICKBAN, HELLO + VACCUUM, LOGOUT, WHO, WHOIS, TIME, TELL, OP, DEOP, KICK, BAN, UNBAN, KICKBAN, HELLO, + TOPIC, }; const @@ -46,6 +47,7 @@ "debug prints some debug infos\r\n", "vaccuum reorganizes the database\r\n", "logout Protected logout function\r\n", + "topic Sets a new topic\r\n", NULL, }; @@ -62,7 +64,7 @@ "!who", "!whois", "!time", "!tell", "!op", "!deop", "!kick", "!ban", "!unban", - "!kickban", "!hello", + "!kickban", "!hello", "!topic", NULL }; @@ -311,6 +313,13 @@ snprintf (msg, sizeof (msg), "PRIVMSG %s :%s, %s?\r\n", message->channel, gettext ("What's up"), message->user); return msg; + + case TOPIC: + if ((token = strtok (NULL, "\r\n")) == NULL) + return NULL; + + snprintf (msg, sizeof (msg), "TOPIC %s :%s\r\n", message->channel, token); + return msg; } } map++;