# HG changeset patch # User Mikael Berthe # Date 1270309535 -7200 # Node ID 5492b87ba9d0d8dfab9385d38075dd50247f9c5a # Parent a20701a2840c48eb060c918d94e2d6f55c55c7e0 Enable say_to ./resource message diff -r a20701a2840c -r 5492b87ba9d0 mcabber/mcabber/commands.c --- a/mcabber/mcabber/commands.c Sat Apr 03 17:07:27 2010 +0200 +++ b/mcabber/mcabber/commands.c Sat Apr 03 17:45:35 2010 +0200 @@ -1496,8 +1496,10 @@ 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; if (!xmpp_is_online()) { scr_LogPrint(LPRINT_NORMAL, "You are not connected."); @@ -1545,7 +1547,12 @@ fjid = *paramlst; msg = *(paramlst+1); - if (!strcmp(fjid, ".")) { + if (!strncmp(fjid, "." JID_RESOURCE_SEPARATORSTR, 2)) + expandfjid = TRUE; + + if (expandfjid || !strcmp(fjid, ".")) { + const gchar *res = fjid+2; + fjid = NULL; // Send the message to the current buddy if (current_buddy) fjid = (char*)buddy_getjid(BUDDATA(current_buddy)); @@ -1554,6 +1561,10 @@ free_arg_lst(paramlst); return; } + if (expandfjid) { + xfjid = g_strdup_printf("%s%c%s", fjid, JID_RESOURCE_SEPARATOR, res); + fjid = xfjid; + } } else if (check_jid_syntax(fjid)) { scr_LogPrint(LPRINT_NORMAL, "Please specify a valid Jabber ID."); free_arg_lst(paramlst); @@ -1575,6 +1586,7 @@ send_message_to(fjid, msg, NULL, msg_type, quiet); + g_free(xfjid); g_free(fjid); g_free(msg); free_arg_lst(paramlst);