Mercurial > pidgin
comparison libpurple/protocols/jabber/iq.c @ 25428:e30e9779e7bf
In jabber_iq_parse, xmlnode_get_child is called for a few special cases,
and then the original xmlnode is passed to the handler. That seems kind of
pointless, since jabber_iq_parse has all the data. So I just passed the
data necessary for each handler instead. I didn't change the query handlers
since they seem to require the parent.
I assume the point was to go for a unified prototype, but since these
handlers are all special cases, I think it's okay to give them a special
signature as well.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 05 Feb 2009 05:42:58 +0000 |
parents | 040c66dffbf0 |
children | 36c73d036026 a34d6975c239 |
comparison
equal
deleted
inserted
replaced
25427:575b2b9f3ac9 | 25428:e30e9779e7bf |
---|---|
307 } | 307 } |
308 | 308 |
309 void jabber_iq_parse(JabberStream *js, xmlnode *packet) | 309 void jabber_iq_parse(JabberStream *js, xmlnode *packet) |
310 { | 310 { |
311 JabberCallbackData *jcd; | 311 JabberCallbackData *jcd; |
312 xmlnode *query, *error, *x; | 312 xmlnode *child, *query, *error, *x; |
313 const char *xmlns; | 313 const char *xmlns; |
314 const char *type, *id, *from; | 314 const char *type, *id, *from; |
315 JabberIqHandler *jih; | 315 JabberIqHandler *jih; |
316 | 316 |
317 query = xmlnode_get_child(packet, "query"); | 317 query = xmlnode_get_child(packet, "query"); |
369 jih(js, packet); | 369 jih(js, packet); |
370 return; | 370 return; |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 if(xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si")) { | 374 if ((child = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { |
375 jabber_si_parse(js, packet); | 375 jabber_si_parse(js, child, from, id); |
376 return; | 376 return; |
377 } | 377 } |
378 | 378 |
379 if(xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { | 379 if (xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { |
380 jabber_gmail_poke(js, packet); | 380 jabber_gmail_poke(js, type); |
381 return; | 381 return; |
382 } | 382 } |
383 | 383 |
384 purple_debug_info("jabber", "jabber_iq_parse\n"); | 384 purple_debug_info("jabber", "jabber_iq_parse\n"); |
385 | 385 |
386 if(xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) { | 386 if (xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) { |
387 jabber_ping_parse(js, packet); | 387 jabber_ping_parse(js, from, id); |
388 return; | 388 return; |
389 } | 389 } |
390 | 390 |
391 if (xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE)) { | 391 if ((child = xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE))) { |
392 jabber_data_parse(js, packet); | 392 jabber_data_parse(js, child, from, id); |
393 return; | 393 return; |
394 } | 394 } |
395 | 395 |
396 /* If we get here, send the default error reply mandated by XMPP-CORE */ | 396 /* If we get here, send the default error reply mandated by XMPP-CORE */ |
397 if(!strcmp(type, "set") || !strcmp(type, "get")) { | 397 if(!strcmp(type, "set") || !strcmp(type, "get")) { |