changeset 490:af6e31e32d9e

Add "/room privmsg"
author Mikael Berthe <mikael@lilotux.net>
date Sat, 08 Oct 2005 00:29:02 +0200
parents 21ab22a60bcb
children 28f67990ce7b
files mcabber/src/commands.c
diffstat 1 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Fri Oct 07 20:12:11 2005 +0200
+++ b/mcabber/src/commands.c	Sat Oct 08 00:29:02 2005 +0200
@@ -159,6 +159,7 @@
   compl_add_category_word(COMPL_ROOM, "leave");
   compl_add_category_word(COMPL_ROOM, "names");
   compl_add_category_word(COMPL_ROOM, "nick");
+  compl_add_category_word(COMPL_ROOM, "privmsg");
   compl_add_category_word(COMPL_ROOM, "remove");
   compl_add_category_word(COMPL_ROOM, "topic");
   compl_add_category_word(COMPL_ROOM, "unlock");
@@ -1085,7 +1086,7 @@
     update_roster = TRUE;
   } else if (!strncasecmp(arg, "invite", 6))  {
     const gchar *roomname;
-    gchar*jid;
+    gchar* jid;
     arg += 6;
     if (*arg++ != ' ') {
       scr_LogPrint(LPRINT_NORMAL, "Wrong or missing parameter");
@@ -1152,6 +1153,36 @@
     cmd = g_strdup_printf("join %s %s", buddy_getjid(bud), arg);
     do_room(cmd);
     g_free(cmd);
+  } else if (!strncasecmp(arg, "privmsg", 7))  {
+    gchar *nick, *cmd;
+    arg += 7;
+    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;
+    }
+    if (!*arg) {
+      scr_LogPrint(LPRINT_NORMAL, "Missing parameter");
+      return;
+    }
+    nick = g_strdup(arg);
+    arg = strchr(nick, ' ');
+    if (!arg) {
+      scr_LogPrint(LPRINT_NORMAL, "Missing parameter");
+      return;
+    }
+    *arg++ = 0;
+    for (; *arg && *arg == ' '; arg++)
+      ;
+    cmd = g_strdup_printf("%s/%s %s", buddy_getjid(bud), nick, arg);
+    do_say_to(cmd);
+    g_free(cmd);
+    g_free(nick);
   } else if (!strcasecmp(arg, "remove"))  {
     if (!(buddy_gettype(bud) & ROSTER_TYPE_ROOM)) {
       scr_LogPrint(LPRINT_NORMAL, "This isn't a chatroom");