cpw.malu.ft_thumbnails: 71882b10: Updated to use new BoB request functiona...
malu at pidgin.im
malu at pidgin.im
Sun Mar 21 17:00:32 EDT 2010
-----------------------------------------------------------------
Revision: 71882b1055f5d7bf391080b3061785a661c5c8e9
Ancestor: f0810f5e79ffe6a1fd46a3325bc7b4bd16f41ab1
Author: malu at pidgin.im
Date: 2010-03-21T20:57:29
Branch: im.pidgin.cpw.malu.ft_thumbnails
URL: http://d.pidgin.im/viewmtn/revision/info/71882b1055f5d7bf391080b3061785a661c5c8e9
Modified files:
libpurple/protocols/jabber/si.c
ChangeLog:
Updated to use new BoB request functionallity
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c ed6bc13eed76e87b6616a046985e7d707cbcf8ae
+++ libpurple/protocols/jabber/si.c c5f80fc0ac97ec0beb5b4357c442888a16f8143c
@@ -1663,27 +1663,17 @@ static void
}
static void
-jabber_si_thumbnail_cb(JabberStream *js, const char *from, JabberIqType type,
- const char *id, xmlnode *packet, gpointer data)
+jabber_si_thumbnail_cb(JabberData *data, gchar *alt, gpointer userdata)
{
- PurpleXfer *xfer = (PurpleXfer *) data;
- xmlnode *data_element = xmlnode_get_child(packet, "data");
- xmlnode *item_not_found = xmlnode_get_child(packet, "item-not-found");
+ PurpleXfer *xfer = (PurpleXfer *) userdata;
- if (data_element) {
- JabberData *data = jabber_data_create_from_xml(data_element);
-
- if (data) {
- purple_xfer_set_thumbnail(xfer, jabber_data_get_data(data),
- jabber_data_get_size(data), jabber_data_get_type(data));
- jabber_data_destroy(data);
- }
- } else if (item_not_found) {
- purple_debug_info("jabber",
- "Responder didn't recognize requested data\n");
- } else {
- purple_debug_error("jabber", "Unknown response to data request\n");
+ if (data) {
+ purple_xfer_set_thumbnail(xfer, jabber_data_get_data(data),
+ jabber_data_get_size(data), jabber_data_get_type(data));
+ /* data is ephemeral, get rid of now (the xfer re-owned the thumbnail */
+ jabber_data_destroy(data);
}
+
purple_xfer_request(xfer);
}
@@ -1782,16 +1772,8 @@ void jabber_si_parse(JabberStream *js, c
NS_THUMBS))) {
const char *cid = xmlnode_get_attrib(thumbnail, "cid");
if (cid) {
- JabberIq *request =
- jabber_iq_new(jsx->js, JABBER_IQ_GET);
-
- purple_debug_info("jabber", "got file thumbnail, request it\n");
- xmlnode_insert_child(request->node,
- jabber_data_get_xml_request(cid));
- xmlnode_set_attrib(request->node, "to",
- purple_xfer_get_remote_user(xfer));
- jabber_iq_set_callback(request, jabber_si_thumbnail_cb, xfer);
- jabber_iq_send(request);
+ jabber_data_request(js, cid, purple_xfer_get_remote_user(xfer),
+ NULL, TRUE, jabber_si_thumbnail_cb, xfer);
} else {
purple_xfer_request(xfer);
}
More information about the Commits
mailing list