Mercurial > ~mikael > mcabber > hg
diff mcabber/mcabber/commands.c @ 1938:26e437e79e60
Fix MUC whois / auto_whois
This patch should fix issue #68:
https://bitbucket.org/McKael/mcabber-crew/issue/68/
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 12 Feb 2011 19:00:59 +0100 |
parents | 924f4552996c |
children | 932d1b250a55 |
line wrap: on
line diff
--- a/mcabber/mcabber/commands.c Sat Feb 12 18:31:31 2011 +0100 +++ b/mcabber/mcabber/commands.c Sat Feb 12 19:00:59 2011 +0100 @@ -2830,9 +2830,11 @@ // cmd_room_whois(..) // If interactive is TRUE, chatmode can be enabled. -void cmd_room_whois(gpointer bud, char *arg, guint interactive) +// Please note that usernick is expected in UTF-8 locale iff interactive is FALSE +// (in order to work correctly with auto_whois). +void cmd_room_whois(gpointer bud, const char *usernick, guint interactive) { - char **paramlst; + char **paramlst = NULL; gchar *nick, *buffer; const char *bjid, *realjid; const char *rst_msg; @@ -2843,17 +2845,20 @@ time_t rst_time; guint msg_flag = HBB_PREFIX_INFO; - paramlst = split_arg(arg, 1, 0); // nickname - nick = *paramlst; + if (interactive) { + paramlst = split_arg(usernick, 1, 0); // nickname + nick = to_utf8(*paramlst); + } else { + nick = g_strdup(usernick); + } if (!nick || !*nick) { scr_LogPrint(LPRINT_NORMAL, "Please specify a nickname."); - free_arg_lst(paramlst); + if (paramlst) + free_arg_lst(paramlst); return; } - nick = to_utf8(nick); - if (interactive) { // Enter chat mode scr_set_chatmode(TRUE); @@ -2866,7 +2871,8 @@ if (rstatus == offline) { scr_LogPrint(LPRINT_NORMAL, "No such member: %s", nick); - free_arg_lst(paramlst); + if (paramlst) + free_arg_lst(paramlst); g_free(nick); return; } @@ -2912,7 +2918,8 @@ g_free(buffer); g_free(nick); - free_arg_lst(paramlst); + if (paramlst) + free_arg_lst(paramlst); } static void room_bookmark(gpointer bud, char *arg)