Mercurial > hg
changeset 1861:81822de0edf6
Fix a potential encoding issue on non-UTF8 systems
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 03 Apr 2010 19:12:20 +0200 |
parents | 5492b87ba9d0 |
children | cca19ce862ef |
files | mcabber/mcabber/commands.c |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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);