Mercurial > pidgin.yaz
changeset 17582:0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Sun, 17 Jun 2007 04:05:28 +0000 |
parents | 5ab3c6bb95b4 |
children | f108b91e2fee |
files | libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/pep.h |
diffstat | 3 files changed, 11 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Sun Jun 17 03:51:19 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sun Jun 17 04:05:28 2007 +0000 @@ -1129,12 +1129,16 @@ g_free(info); } -static void do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *item) { - xmlnode *data; +static void do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) { + xmlnode *item, *data; const char *checksum; char *b64data; void *img; size_t size; + if(!items) + return; + + item = xmlnode_get_child(items, "item"); if(!item) return;
--- a/libpurple/protocols/jabber/pep.c Sun Jun 17 03:51:19 2007 +0000 +++ b/libpurple/protocols/jabber/pep.c Sun Jun 17 04:05:28 2007 +0000 @@ -49,20 +49,13 @@ static void do_pep_iq_request_item_callback(JabberStream *js, xmlnode *packet, gpointer data) { const char *from = xmlnode_get_attrib(packet,"from"); xmlnode *pubsub = xmlnode_get_child_with_namespace(packet,"pubsub","http://jabber.org/protocol/pubsub#event"); - xmlnode *item = NULL; + xmlnode *items = NULL; JabberPEPHandler *cb = data; - if(pubsub) { - item = xmlnode_get_child(pubsub, "item"); - if(!item) { - /* does not follow the spec, but the ejabberd PEP implementation behaves that way */ - xmlnode *items = xmlnode_get_child(pubsub, "items"); - if(items) - item = xmlnode_get_child(items, "item"); - } - } + if(pubsub) + items = xmlnode_get_child(pubsub, "items"); - cb(js, from, item); + cb(js, from, items); } void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb) {
--- a/libpurple/protocols/jabber/pep.h Sun Jun 17 03:51:19 2007 +0000 +++ b/libpurple/protocols/jabber/pep.h Sun Jun 17 04:05:28 2007 +0000 @@ -57,8 +57,7 @@ * @parameter id The item id of the requested item (may be NULL) * @parameter cb The callback to be used when this item is received * - * ATTN: The items parameter of the callback will only point to the single <item> element here! - * Additionally, the items element passed will be NULL if any error occured (like a permission error, node doesn't exist etc.) + * The items element passed to the callback will be NULL if any error occured (like a permission error, node doesn't exist etc.) */ void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb);