Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/iq.c @ 25062: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 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/iq.c Thu Feb 05 04:23:14 2009 +0000 +++ b/libpurple/protocols/jabber/iq.c Thu Feb 05 05:42:58 2009 +0000 @@ -309,7 +309,7 @@ void jabber_iq_parse(JabberStream *js, xmlnode *packet) { JabberCallbackData *jcd; - xmlnode *query, *error, *x; + xmlnode *child, *query, *error, *x; const char *xmlns; const char *type, *id, *from; JabberIqHandler *jih; @@ -371,25 +371,25 @@ } } - if(xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si")) { - jabber_si_parse(js, packet); + if ((child = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { + jabber_si_parse(js, child, from, id); return; } - if(xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { - jabber_gmail_poke(js, packet); + if (xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { + jabber_gmail_poke(js, type); return; } purple_debug_info("jabber", "jabber_iq_parse\n"); - if(xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) { - jabber_ping_parse(js, packet); + if (xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) { + jabber_ping_parse(js, from, id); return; } - if (xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE)) { - jabber_data_parse(js, packet); + if ((child = xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE))) { + jabber_data_parse(js, child, from, id); return; }