# HG changeset patch # User Mikael Berthe # Date 1270314740 -7200 # Node ID 81822de0edf6cdbe52c41c46c2219a3bab3c5c0b # Parent 5492b87ba9d0d8dfab9385d38075dd50247f9c5a Fix a potential encoding issue on non-UTF8 systems diff -r 5492b87ba9d0 -r 81822de0edf6 mcabber/mcabber/commands.c --- a/mcabber/mcabber/commands.c Sat Apr 03 17:45:35 2010 +0200 +++ b/mcabber/mcabber/commands.c Sat Apr 03 19:12:20 2010 +0200 @@ -1496,7 +1496,6 @@ char **paramlst; char *fjid, *msg; char *file = NULL; - char *xfjid = NULL; LmMessageSubType msg_type = LM_MESSAGE_SUB_TYPE_NOT_SET; bool quiet = FALSE; bool expandfjid = FALSE; @@ -1561,17 +1560,21 @@ free_arg_lst(paramlst); return; } - if (expandfjid) { - xfjid = g_strdup_printf("%s%c%s", fjid, JID_RESOURCE_SEPARATOR, res); - fjid = xfjid; + if (expandfjid && *res) { + char *res_utf8 = to_utf8(res); + fjid = g_strdup_printf("%s%c%s", fjid, JID_RESOURCE_SEPARATOR, res_utf8); + g_free(res_utf8); } - } else if (check_jid_syntax(fjid)) { + } else + fjid = to_utf8(fjid); + + if (check_jid_syntax(fjid)) { scr_LogPrint(LPRINT_NORMAL, "Please specify a valid Jabber ID."); free_arg_lst(paramlst); + g_free(fjid); return; } - fjid = to_utf8(fjid); if (!file) { msg = to_utf8(msg); } else { @@ -1586,7 +1589,6 @@ send_message_to(fjid, msg, NULL, msg_type, quiet); - g_free(xfjid); g_free(fjid); g_free(msg); free_arg_lst(paramlst);