cpw.malu.ft_thumbnails: 8fadf2c4: Create the thumbnail data and include th...

malu at pidgin.im malu at pidgin.im
Tue Jun 30 13:40:21 EDT 2009


-----------------------------------------------------------------
Revision: 8fadf2c4c313e276d7c4eea64a921d82ef9a2bba
Ancestor: 9265a75ad797e6127091cfce270271205dd9fee8
Author: malu at pidgin.im
Date: 2009-06-30T17:34:51
Branch: im.pidgin.cpw.malu.ft_thumbnails
URL: http://d.pidgin.im/viewmtn/revision/info/8fadf2c4c313e276d7c4eea64a921d82ef9a2bba

Modified files:
        libpurple/protocols/jabber/si.c

ChangeLog: 

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...

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	b80705ff08bf341a6d8821ceb988ef5ea2ddf8a5
+++ libpurple/protocols/jabber/si.c	7e6534f12d83607239600ac3da36d5cbe5479819
@@ -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 @@ static void jabber_si_xfer_send_request(
 	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");


More information about the Commits mailing list