changeset 29787:7d8b074feda2

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...
author Marcus Lundblad <ml@update.uu.se>
date Tue, 30 Jun 2009 17:34:51 +0000
parents b6dda7d483a2
children 259a331e4de7
files libpurple/protocols/jabber/si.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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");