# HG changeset patch # User Mikael Berthe # Date 1267353219 -3600 # Node ID b18142457ca9d94449b582e8ba21d836e3fd9fbc # Parent 8cfc2a386b1fe77787d920c1502c9e89c0c3908a Fix vCard requests in MUC rooms diff -r 8cfc2a386b1f -r b18142457ca9 mcabber/mcabber/commands.c --- a/mcabber/mcabber/commands.c Sun Feb 28 10:20:13 2010 +0100 +++ b/mcabber/mcabber/commands.c Sun Feb 28 11:33:39 2010 +0100 @@ -3227,7 +3227,7 @@ static void do_request(char *arg) { char **paramlst; - char *fjid, *type, *tmp; + char *fjid, *type; enum iqreq_type numtype = iqreq_none; char *jid_utf8 = NULL; @@ -3290,9 +3290,15 @@ if (fjid) { switch (numtype) { case iqreq_vcard: - // vCards requests are done to bare jid - tmp = strchr(fjid, JID_RESOURCE_SEPARATOR); - if (tmp) *tmp = '\0'; + { // vCards requests are sent to the bare jid, except in MUC rooms + gchar *tmp = strchr(fjid, JID_RESOURCE_SEPARATOR); + if (tmp) { + gchar *bjid = jidtodisp(fjid); + if (!roster_find(bjid, jidsearch, ROSTER_TYPE_ROOM)) + *tmp = '\0'; + g_free(bjid); + } + } case iqreq_version: case iqreq_time: case iqreq_last: diff -r 8cfc2a386b1f -r b18142457ca9 mcabber/mcabber/xmpp.c --- a/mcabber/mcabber/xmpp.c Sun Feb 28 10:20:13 2010 +0100 +++ b/mcabber/mcabber/xmpp.c Sun Feb 28 11:33:39 2010 +0100 @@ -235,6 +235,7 @@ GSList *resources, *p_res; GSList *roster_elt; const char *strreqtype, *xmlns; + gboolean vcard2user; if (reqtype == iqreq_version) { xmlns = NS_VERSION; @@ -254,9 +255,13 @@ } else return; - if (strchr(fjid, JID_RESOURCE_SEPARATOR) || reqtype == iqreq_vcard) { - // This is a full JID - // Or a vCard request, resource should have been stripped before + // Is it a vCard request to a regular user? + // (vCard requests are sent to bare JIDs, except in MUC rooms...) + vcard2user = (reqtype == iqreq_vcard && + !roster_find(fjid, jidsearch, ROSTER_TYPE_ROOM)); + + if (strchr(fjid, JID_RESOURCE_SEPARATOR) || vcard2user) { + // This is a full JID or a vCard request to a contact xmpp_iq_request(fjid, xmlns); scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid); return; diff -r 8cfc2a386b1f -r b18142457ca9 mcabber/mcabber/xmpp_muc.c --- a/mcabber/mcabber/xmpp_muc.c Sun Feb 28 10:20:13 2010 +0100 +++ b/mcabber/mcabber/xmpp_muc.c Sun Feb 28 11:33:39 2010 +0100 @@ -672,7 +672,7 @@ const char *id; char *desc = g_strdup_printf("<%s> invites you to %s", from, to); event_muc_invitation *invitation; - + invitation = g_new(event_muc_invitation, 1); invitation->to = g_strdup(to); invitation->from = g_strdup(from);