cpw.malu.xmpp.jingle_ft: 3cbb10bf: Try to look for entety caps before launc...

malu at pidgin.im malu at pidgin.im
Tue Aug 11 15:16:10 EDT 2009


-----------------------------------------------------------------
Revision: 3cbb10bfb6f52d9668fe6213a57e701bfcff6d68
Ancestor: 91c8582275000dc0525fe1123e3a249e60821cd6
Author: malu at pidgin.im
Date: 2009-08-11T19:13:05
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/3cbb10bfb6f52d9668fe6213a57e701bfcff6d68

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

ChangeLog: 

Try to look for entety caps before launching a disco query for SI features.
"Backported" from ipp..

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/si.c	45c583d347b48c5b5bb9fa023fc9364234c223b9
+++ libpurple/protocols/jabber/si.c	e39a6d3a785af3786b9c7288965064ca5d039744
@@ -1448,9 +1448,35 @@ static void do_transfer_send(PurpleXfer 
 static void do_transfer_send(PurpleXfer *xfer)
 {
 	JabberSIXfer *jsx = xfer->data;
+	JabberBuddy *jb = jabber_buddy_find(jsx->js, xfer->who, FALSE);
+	JabberBuddyResource *jbr = NULL;
 
-	jabber_disco_info_do(jsx->js, xfer->who,
+	if (jb) {
+		gchar *resource = jabber_get_resource(xfer->who);
+
+		jbr = jabber_buddy_find_resource(jb, resource);
+		g_free(resource);
+	}
+
+	if (jbr) {
+		char *msg;
+
+		if (jabber_resource_has_capability(jbr, XEP_0047_NAMESPACE))
+			jsx->stream_method |= STREAM_METHOD_IBB;
+		if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/si/profile/file-transfer")) {
+			jabber_si_xfer_send_request(xfer);
+			return;
+		}
+
+		msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), xfer->who);
+		purple_notify_error(jsx->js->gc, _("File Send Failed"),
+				_("File Send Failed"), msg);
+		g_free(msg);
+		purple_xfer_cancel_local(xfer);
+	} else {
+		jabber_disco_info_do(jsx->js, xfer->who,
 			jabber_si_xfer_send_disco_cb, xfer);
+	}
 }
 
 static void jabber_si_xfer_init(PurpleXfer *xfer)


More information about the Commits mailing list