Mercurial > ~mikael > mcabber > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1721:8cfc2a386b1f | 1722:b18142457ca9 |
---|---|
233 void xmpp_request(const char *fjid, enum iqreq_type reqtype) | 233 void xmpp_request(const char *fjid, enum iqreq_type reqtype) |
234 { | 234 { |
235 GSList *resources, *p_res; | 235 GSList *resources, *p_res; |
236 GSList *roster_elt; | 236 GSList *roster_elt; |
237 const char *strreqtype, *xmlns; | 237 const char *strreqtype, *xmlns; |
238 gboolean vcard2user; | |
238 | 239 |
239 if (reqtype == iqreq_version) { | 240 if (reqtype == iqreq_version) { |
240 xmlns = NS_VERSION; | 241 xmlns = NS_VERSION; |
241 strreqtype = "version"; | 242 strreqtype = "version"; |
242 } else if (reqtype == iqreq_time) { | 243 } else if (reqtype == iqreq_time) { |
252 xmlns = NS_VCARD; | 253 xmlns = NS_VCARD; |
253 strreqtype = "vCard"; | 254 strreqtype = "vCard"; |
254 } else | 255 } else |
255 return; | 256 return; |
256 | 257 |
257 if (strchr(fjid, JID_RESOURCE_SEPARATOR) || reqtype == iqreq_vcard) { | 258 // Is it a vCard request to a regular user? |
258 // This is a full JID | 259 // (vCard requests are sent to bare JIDs, except in MUC rooms...) |
259 // Or a vCard request, resource should have been stripped before | 260 vcard2user = (reqtype == iqreq_vcard && |
261 !roster_find(fjid, jidsearch, ROSTER_TYPE_ROOM)); | |
262 | |
263 if (strchr(fjid, JID_RESOURCE_SEPARATOR) || vcard2user) { | |
264 // This is a full JID or a vCard request to a contact | |
260 xmpp_iq_request(fjid, xmlns); | 265 xmpp_iq_request(fjid, xmlns); |
261 scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid); | 266 scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid); |
262 return; | 267 return; |
263 } | 268 } |
264 | 269 |