Mercurial > pidgin
changeset 25433:36c73d036026
disapproval of revision '8a80f271858548f73cac50625660e87df1970bcc'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 08 Feb 2009 00:23:13 +0000 |
parents | e30e9779e7bf |
children | 2035b8164aca |
files | libpurple/protocols/jabber/data.c libpurple/protocols/jabber/data.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/google.h libpurple/protocols/jabber/iq.c libpurple/protocols/jabber/ping.c libpurple/protocols/jabber/ping.h libpurple/protocols/jabber/si.c libpurple/protocols/jabber/si.h |
diffstat | 9 files changed, 35 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/data.c Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/data.c Sun Feb 08 00:23:13 2009 +0000 @@ -200,9 +200,11 @@ } void -jabber_data_parse(JabberStream *js, xmlnode *data_node, const char *who, const char *id) +jabber_data_parse(JabberStream *js, xmlnode *packet) { JabberIq *result = NULL; + const char *who = xmlnode_get_attrib(packet, "from"); + xmlnode *data_node = xmlnode_get_child(packet, "data"); const JabberData *data = jabber_data_find_local_by_cid(xmlnode_get_attrib(data_node, "cid")); @@ -211,12 +213,12 @@ result = jabber_iq_new(js, JABBER_IQ_ERROR); xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); + xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); xmlnode_insert_child(result->node, item_not_found); } else { result = jabber_iq_new(js, JABBER_IQ_RESULT); xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); + xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); xmlnode_insert_child(result->node, jabber_data_get_xml_definition(data)); }
--- a/libpurple/protocols/jabber/data.h Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/data.h Sun Feb 08 00:23:13 2009 +0000 @@ -65,8 +65,7 @@ void jabber_data_associate_remote(JabberData *data); /* handles iq requests */ -void jabber_data_parse(JabberStream *js, xmlnode *data_node, - const char *who, const char *id); +void jabber_data_parse(JabberStream *js, xmlnode *packet); void jabber_data_init(void); void jabber_data_uninit(void);
--- a/libpurple/protocols/jabber/google.c Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Sun Feb 08 00:23:13 2009 +0000 @@ -144,8 +144,9 @@ } void -jabber_gmail_poke(JabberStream *js, const char *type) +jabber_gmail_poke(JabberStream *js, xmlnode *packet) { + const char *type; xmlnode *query; JabberIq *iq; @@ -153,8 +154,11 @@ if (!purple_account_get_check_mail(js->gc->account)) return; + type = xmlnode_get_attrib(packet, "type"); + + /* Is this an initial incoming mail notification? If so, send a request for more info */ - if (strcmp(type, "set")) + if (strcmp(type, "set") || !xmlnode_get_child(packet, "new-mail")) return; purple_debug(PURPLE_DEBUG_MISC, "jabber",
--- a/libpurple/protocols/jabber/google.h Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/google.h Sun Feb 08 00:23:13 2009 +0000 @@ -27,7 +27,7 @@ #include "jabber.h" void jabber_gmail_init(JabberStream *js); -void jabber_gmail_poke(JabberStream *js, const char *type); +void jabber_gmail_poke(JabberStream *js, xmlnode *node); void jabber_google_roster_init(JabberStream *js); void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item);
--- a/libpurple/protocols/jabber/iq.c Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/iq.c Sun Feb 08 00:23:13 2009 +0000 @@ -309,7 +309,7 @@ void jabber_iq_parse(JabberStream *js, xmlnode *packet) { JabberCallbackData *jcd; - xmlnode *child, *query, *error, *x; + xmlnode *query, *error, *x; const char *xmlns; const char *type, *id, *from; JabberIqHandler *jih; @@ -371,25 +371,25 @@ } } - if ((child = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { - jabber_si_parse(js, child, from, id); + if(xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si")) { + jabber_si_parse(js, packet); return; } - if (xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { - jabber_gmail_poke(js, type); + if(xmlnode_get_child_with_namespace(packet, "new-mail", "google:mail:notify")) { + jabber_gmail_poke(js, packet); return; } purple_debug_info("jabber", "jabber_iq_parse\n"); - if (xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) { - jabber_ping_parse(js, from, id); + if(xmlnode_get_child_with_namespace(packet, "ping", "urn:xmpp:ping")) { + jabber_ping_parse(js, packet); return; } - if ((child = xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE))) { - jabber_data_parse(js, child, from, id); + if (xmlnode_get_child_with_namespace(packet, "data", XEP_0231_NAMESPACE)) { + jabber_data_parse(js, packet); return; }
--- a/libpurple/protocols/jabber/ping.c Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/ping.c Sun Feb 08 00:23:13 2009 +0000 @@ -30,7 +30,7 @@ #include "iq.h" void -jabber_ping_parse(JabberStream *js, const char *from, const char *id) +jabber_ping_parse(JabberStream *js, xmlnode *packet) { JabberIq *iq; @@ -38,9 +38,9 @@ iq = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", from); + xmlnode_set_attrib(iq->node, "to", xmlnode_get_attrib(packet, "from") ); - jabber_iq_set_id(iq, id); + jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id")); jabber_iq_send(iq); }
--- a/libpurple/protocols/jabber/ping.h Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/ping.h Sun Feb 08 00:23:13 2009 +0000 @@ -26,8 +26,7 @@ #include "conversation.h" void jabber_ping_parse(JabberStream *js, - const char *from, - const char *id); + xmlnode *packet); gboolean jabber_ping_jid(PurpleConversation *conv, const char *jid);
--- a/libpurple/protocols/jabber/si.c Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/si.c Sun Feb 08 00:23:13 2009 +0000 @@ -1182,14 +1182,17 @@ purple_xfer_request(xfer); } -void jabber_si_parse(JabberStream *js, xmlnode *si, const char *from, const char *id) +void jabber_si_parse(JabberStream *js, xmlnode *packet) { JabberSIXfer *jsx; PurpleXfer *xfer; - xmlnode *file, *feature, *x, *field, *option, *value; - const char *stream_id, *filename, *filesize_c, *profile; + xmlnode *si, *file, *feature, *x, *field, *option, *value; + const char *stream_id, *filename, *filesize_c, *profile, *from; size_t filesize = 0; + if(!(si = xmlnode_get_child(packet, "si"))) + return; + if(!(profile = xmlnode_get_attrib(si, "profile")) || strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) return; @@ -1212,7 +1215,7 @@ if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) return; - if(!from) + if(!(from = xmlnode_get_attrib(packet, "from"))) return; /* if they've already sent us this file transfer with the same damn id @@ -1253,7 +1256,7 @@ jsx->js = js; jsx->stream_id = g_strdup(stream_id); - jsx->iq_id = g_strdup(id); + jsx->iq_id = g_strdup(xmlnode_get_attrib(packet, "id")); xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); if (xfer)
--- a/libpurple/protocols/jabber/si.h Thu Feb 05 05:42:58 2009 +0000 +++ b/libpurple/protocols/jabber/si.h Sun Feb 08 00:23:13 2009 +0000 @@ -27,7 +27,7 @@ #include "jabber.h" void jabber_bytestreams_parse(JabberStream *js, xmlnode *packet); -void jabber_si_parse(JabberStream *js, xmlnode *si, const char *from, const char *id); +void jabber_si_parse(JabberStream *js, xmlnode *packet); PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who); void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file);