diff mcabber/mcabber/xmpp.c @ 1722:b18142457ca9

Fix vCard requests in MUC rooms
author Mikael Berthe <mikael@lilotux.net>
date Sun, 28 Feb 2010 11:33:39 +0100
parents 8cfc2a386b1f
children 15b3834cbe5f
line wrap: on
line diff
--- 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;