# HG changeset patch # User Marcus Lundblad # Date 1246383291 0 # Node ID 7d8b074feda2a2eb8b93e07df2c384acd6dec33e # Parent b6dda7d483a2503fe6847493ddbeabf7c315544a Create the thumbnail data and include the "thumbnail" element in the file transfer offer for jabber. This should propably be moved to some utility file, to easy sharing with jingle ft later on... Still doesn't do anything with incoming file transfers, though... diff -r b6dda7d483a2 -r 7d8b074feda2 libpurple/protocols/jabber/si.c --- a/libpurple/protocols/jabber/si.c Mon Jun 29 20:44:45 2009 +0000 +++ b/libpurple/protocols/jabber/si.c Tue Jun 30 17:34:51 2009 +0000 @@ -30,6 +30,7 @@ #include "notify.h" #include "buddy.h" +#include "data.h" #include "disco.h" #include "jabber.h" #include "ibb.h" @@ -1279,6 +1280,21 @@ xmlnode_set_attrib(file, "size", buf); /* maybe later we'll do hash and date attribs */ + /* add thumbnail, if appropriate */ + if (purple_xfer_get_thumbnail_data(xfer)) { + JabberData *thumbnail_data = + jabber_data_create_from_data(purple_xfer_get_thumbnail_data(xfer), + purple_xfer_get_thumbnail_size(xfer), "image/jpeg", TRUE, + jsx->js); + xmlnode *thumbnail = xmlnode_new_child(file, "thumbnail"); + xmlnode_set_namespace(thumbnail, "urn:xmpp:thumbs:0"); + xmlnode_set_attrib(thumbnail, "cid", + jabber_data_get_cid(thumbnail_data)); + xmlnode_set_attrib(thumbnail, "mime-type", "image/jpeg"); + /* cache data */ + jabber_data_associate_local(thumbnail_data, NULL); + } + feature = xmlnode_new_child(si, "feature"); xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); x = xmlnode_new_child(feature, "x");