diff mcabber/mcabber/commands.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 98d99485d276
children 318c64ceb494
line wrap: on
line diff
--- 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: