src/parse.c
changeset 40 5b7e8dba46a0
parent 39 0ae006af497e
child 45 535478a0f482
--- 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++;