Mercurial > pidgin
comparison src/protocols/jabber/presence.c @ 13806:25e63008d3bb
[gaim-migrate @ 16229]
Use libxml2 for XML parsing, if available. The biggest benefit from this is actual support for XML namespaces. This fixes a handful of Google Talk integration problems, including typing notifications and buddy icons.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 08 Jun 2006 01:03:51 +0000 |
parents | d2aadcdbec6c |
children | 2bac009eaa0c |
comparison
equal
deleted
inserted
replaced
13805:853fefb07c79 | 13806:25e63008d3bb |
---|---|
119 presence = jabber_presence_create(state, stripped, priority); | 119 presence = jabber_presence_create(state, stripped, priority); |
120 g_free(stripped); | 120 g_free(stripped); |
121 | 121 |
122 if(js->avatar_hash) { | 122 if(js->avatar_hash) { |
123 x = xmlnode_new_child(presence, "x"); | 123 x = xmlnode_new_child(presence, "x"); |
124 xmlnode_set_attrib(x, "xmlns", "vcard-temp:x:update"); | 124 xmlnode_set_namespace(x, "vcard-temp:x:update"); |
125 photo = xmlnode_new_child(x, "photo"); | 125 photo = xmlnode_new_child(x, "photo"); |
126 xmlnode_insert_data(photo, js->avatar_hash, -1); | 126 xmlnode_insert_data(photo, js->avatar_hash, -1); |
127 } | 127 } |
128 | 128 |
129 jabber_send(js, presence); | 129 jabber_send(js, presence); |
165 g_free(pstr); | 165 g_free(pstr); |
166 } | 166 } |
167 | 167 |
168 /* JEP-0115 */ | 168 /* JEP-0115 */ |
169 c = xmlnode_new_child(presence, "c"); | 169 c = xmlnode_new_child(presence, "c"); |
170 xmlnode_set_attrib(c, "xmlns", "http://jabber.org/protocol/caps"); | 170 xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); |
171 xmlnode_set_attrib(c, "node", CAPS0115_NODE); | 171 xmlnode_set_attrib(c, "node", CAPS0115_NODE); |
172 xmlnode_set_attrib(c, "ver", VERSION); | 172 xmlnode_set_attrib(c, "ver", VERSION); |
173 | 173 |
174 return presence; | 174 return presence; |
175 } | 175 } |
288 JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN; | 288 JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN; |
289 xmlnode *y; | 289 xmlnode *y; |
290 gboolean muc = FALSE; | 290 gboolean muc = FALSE; |
291 char *avatar_hash = NULL; | 291 char *avatar_hash = NULL; |
292 | 292 |
293 | |
294 if(!(jb = jabber_buddy_find(js, from, TRUE))) | 293 if(!(jb = jabber_buddy_find(js, from, TRUE))) |
295 return; | 294 return; |
296 | 295 |
297 if(!(jid = jabber_id_new(from))) | 296 if(!(jid = jabber_id_new(from))) |
298 return; | 297 return; |
361 if(p) { | 360 if(p) { |
362 priority = atoi(p); | 361 priority = atoi(p); |
363 g_free(p); | 362 g_free(p); |
364 } | 363 } |
365 } else if(!strcmp(y->name, "x")) { | 364 } else if(!strcmp(y->name, "x")) { |
366 const char *xmlns = xmlnode_get_attrib(y, "xmlns"); | 365 const char *xmlns = xmlnode_get_namespace(y); |
367 if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { | 366 if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { |
368 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ | 367 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
369 delayed = TRUE; | 368 delayed = TRUE; |
370 } else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { | 369 } else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { |
371 xmlnode *z; | 370 xmlnode *z; |
462 if(chat->muc) { | 461 if(chat->muc) { |
463 xmlnode *x; | 462 xmlnode *x; |
464 for(x = xmlnode_get_child(packet, "x"); x; x = xmlnode_get_next_twin(x)) { | 463 for(x = xmlnode_get_child(packet, "x"); x; x = xmlnode_get_next_twin(x)) { |
465 const char *xmlns, *nick, *code; | 464 const char *xmlns, *nick, *code; |
466 xmlnode *stat, *item; | 465 xmlnode *stat, *item; |
467 if(!(xmlns = xmlnode_get_attrib(x, "xmlns")) || | 466 if(!(xmlns = xmlnode_get_namespace(x)) || |
468 strcmp(xmlns, "http://jabber.org/protocol/muc#user")) | 467 strcmp(xmlns, "http://jabber.org/protocol/muc#user")) |
469 continue; | 468 continue; |
470 if(!(stat = xmlnode_get_child(x, "status"))) | 469 if(!(stat = xmlnode_get_child(x, "status"))) |
471 continue; | 470 continue; |
472 if(!(code = xmlnode_get_attrib(stat, "code"))) | 471 if(!(code = xmlnode_get_attrib(stat, "code"))) |
558 js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb); | 557 js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb); |
559 | 558 |
560 iq = jabber_iq_new(js, JABBER_IQ_GET); | 559 iq = jabber_iq_new(js, JABBER_IQ_GET); |
561 xmlnode_set_attrib(iq->node, "to", buddy_name); | 560 xmlnode_set_attrib(iq->node, "to", buddy_name); |
562 vcard = xmlnode_new_child(iq->node, "vCard"); | 561 vcard = xmlnode_new_child(iq->node, "vCard"); |
563 xmlnode_set_attrib(vcard, "xmlns", "vcard-temp"); | 562 xmlnode_set_namespace(vcard, "vcard-temp"); |
564 | 563 |
565 jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL); | 564 jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL); |
566 jabber_iq_send(iq); | 565 jabber_iq_send(iq); |
567 } | 566 } |
568 } | 567 } |