Mercurial > pidgin
diff libpurple/protocols/jabber/ping.c @ 25648:050052891c55
Pass IQ handlers type, from, id, and the child node
As QuLogic pointed out in 8a80f271, it's pointless for the handlers to re-get
the information from the IQ stanza. Additionally, instead of string-matching
the type everywhere, pass around a JabberIqType.
Last, 'child' cannot be NULL, but 'from' may be.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 08 Feb 2009 06:31:18 +0000 |
parents | ced3d4ab745a |
children | c8606917787a |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/ping.c Sun Feb 08 04:30:23 2009 +0000 +++ b/libpurple/protocols/jabber/ping.c Sun Feb 08 06:31:18 2009 +0000 @@ -35,29 +35,19 @@ } void -jabber_ping_parse(JabberStream *js, xmlnode *packet) +jabber_ping_parse(JabberStream *js, const char *from, + JabberIqType type, const char *id, xmlnode *ping) { - const char *type, *id, *from; - - type = xmlnode_get_attrib(packet, "type"); - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - - if (!type) { - purple_debug_warning("jabber", "jabber_ping with no type\n"); - return; - } - purple_debug_info("jabber", "jabber_ping_parse\n"); - if (!strcmp(type, "get")) { + if (type == JABBER_IQ_GET) { JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT); xmlnode_set_attrib(iq->node, "to", from); xmlnode_set_attrib(iq->node, "id", id); jabber_iq_send(iq); - } else if (!strcmp(type, "set")) { + } else if (type == JABBER_IQ_SET) { /* XXX: error */ } }