# HG changeset patch # User Mikael Berthe # Date 1128724142 -7200 # Node ID af6e31e32d9e49a1ea7fa3eb1fe8863e93e08383 # Parent 21ab22a60bcb76a68d9a24cd4fd32d578a5c12f2 Add "/room privmsg" diff -r 21ab22a60bcb -r af6e31e32d9e mcabber/src/commands.c --- 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");