diff mcabber/src/commands.c @ 475:fa49ac0bb8f3

Add "/room topic", and display topic changes
author Mikael Berthe <mikael@lilotux.net>
date Sun, 02 Oct 2005 23:36:39 +0200
parents 75442262c082
children 882e1acae422
line wrap: on
line diff
--- a/mcabber/src/commands.c	Sun Oct 02 23:29:01 2005 +0200
+++ b/mcabber/src/commands.c	Sun Oct 02 23:36:39 2005 +0200
@@ -156,6 +156,7 @@
   compl_add_category_word(COMPL_ROOM, "names");
   compl_add_category_word(COMPL_ROOM, "nick");
   compl_add_category_word(COMPL_ROOM, "remove");
+  compl_add_category_word(COMPL_ROOM, "topic");
   compl_add_category_word(COMPL_ROOM, "unlock");
 }
 
@@ -253,7 +254,7 @@
   }
 
   // Network part
-  jb_send_msg(jid, msg, buddy_gettype(BUDDATA(current_buddy)));
+  jb_send_msg(jid, msg, buddy_gettype(BUDDATA(current_buddy)), NULL);
 }
 
 //  process_command(line)
@@ -1082,6 +1083,22 @@
       return;
     }
     jb_room_unlock(buddy_getjid(bud));
+  } else if (!strncasecmp(arg, "topic", 5))  {
+    gchar *msg;
+    arg += 5;
+    if (*arg++ != ' ') {
+      scr_LogPrint(LPRINT_NORMAL, "Wrong or missing parameter");
+      return;
+    }
+    for (; *arg && *arg == ' '; arg++)
+      ;
+    if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) {
+      scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom");
+      return;
+    }
+    msg = g_strdup_printf("/me has set the topic to: %s", arg);
+    jb_send_msg(buddy_getjid(bud), msg, ROSTER_TYPE_ROOM, arg);
+    g_free(msg);
   } else {
     scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
   }