cpw.malu.xmpp.jingle_ft: f633398d: Actually send the proxy error message.

malu at pidgin.im malu at pidgin.im
Thu Jan 14 13:55:32 EST 2010


-----------------------------------------------------------------
Revision: f633398d6092cef1bd49df2b3d21270d365d685a
Ancestor: e4585f9396c61a0e5e75073c9a4b76604e228ea0
Author: malu at pidgin.im
Date: 2010-01-14T18:52:16
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/f633398d6092cef1bd49df2b3d21270d365d685a

Modified files:
        libpurple/ft.c
        libpurple/protocols/jabber/jingle/file-transfer.c
        libpurple/protocols/jabber/jingle/s5b.c

ChangeLog: 

Actually send the proxy error message.
Wait for response on session-terminate when closing connections.
Added some debug output for xfer watcher
It still doesn't offer IBB fallback on proxy-error, the fallback logic will need to be updated...

-------------- next part --------------
============================================================
--- libpurple/ft.c	6d6ca9832846fcf8df42a0c89f8e644bcf60bf02
+++ libpurple/ft.c	a9a486518644ce643039db36571bb423534153e6
@@ -1169,6 +1169,8 @@ transfer_cb(gpointer data, gint source, 
 {
 	PurpleXfer *xfer = data;
 
+	purple_debug_info("filetransfer", "transfer_cb: xfer: %p\n", xfer);
+	
 	if (xfer->dest_fp == NULL) {
 		/* The UI is moderating its side manually */
 		PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
@@ -1411,10 +1413,11 @@ purple_xfer_cancel_local(PurpleXfer *xfe
 	}
 
 	if (xfer->watcher != 0) {
+		purple_debug_info("filetransfer", "cancel_local: remove watcher\n");
 		purple_input_remove(xfer->watcher);
 		xfer->watcher = 0;
 	}
-
+	
 	if (xfer->fd != -1)
 		close(xfer->fd);
 
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	bdb5b3b6a5afc0fc3027ac06e9b7918c276f5df9
+++ libpurple/protocols/jabber/jingle/file-transfer.c	7d8dd8010353517bde012dcf8e624d187865a463
@@ -550,7 +550,7 @@ jingle_file_transfer_cancel_send(PurpleX
 		JingleTransport *transport = jingle_content_get_transport(content);
 
 		if (JINGLE_IS_S5B(transport) &&
-		    jingle_s5b_is_connected(JINGLE_S5B(transport))) {
+		    !jingle_s5b_is_connected(JINGLE_S5B(transport))) {
 			jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
 		}
 
@@ -564,9 +564,24 @@ jingle_file_transfer_cancel_send(PurpleX
 		JINGLE_FT(content)->priv->xfer = NULL;
 	}
 	g_object_unref(session);
+	g_object_unref(session);
 }
 
 static void
+jingle_file_transfer_terminate_cb(JabberStream *js, const char *from,
+                                JabberIqType type, const char *id,
+                                xmlnode *packet, gpointer data)
+{
+	PurpleXfer *xfer = (PurpleXfer *) data;
+	JingleContent *content = (JingleContent *) xfer->data;
+	JingleSession *session = jingle_content_get_session(content);
+
+	JINGLE_FT(content)->priv->xfer = NULL;
+	g_object_unref(session);
+	g_object_unref(session);
+}
+
+static void
 jingle_file_transfer_cancel_recv(PurpleXfer *xfer)
 {
 	JingleContent *content = (JingleContent *) xfer->data;
@@ -574,20 +589,20 @@ jingle_file_transfer_cancel_recv(PurpleX
 
 	if (session) {
 		JingleTransport *transport = jingle_content_get_transport(content);
+		JabberIq *terminate = 
+			jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE);
 
+		jabber_iq_set_callback(terminate, jingle_file_transfer_terminate_cb, xfer);
+		
 		if (JINGLE_IS_S5B(transport) 
 		    && !jingle_s5b_is_connected(JINGLE_S5B(transport))) {
 			jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
 		}
 
 		purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_recv\n");
-		jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
+		jabber_iq_send(terminate);
 		g_object_unref(transport);
-		/* disassociate xfer from session */
-		JINGLE_FT(content)->priv->xfer = NULL;
 	}
-	g_object_unref(session);
-	g_object_unref(session);
 }
 
 static void
@@ -601,14 +616,20 @@ jingle_file_transfer_xfer_end(PurpleXfer
 		/* the receiver will send a session-terminate when the whole file has
 		 been received */
 		if (!jingle_session_is_initiator(session)) {
-			jabber_iq_send(jingle_session_terminate_packet(session, "success"));
+			JabberIq *terminate =
+				jingle_session_terminate_packet(session, "success");
+
+			jabber_iq_set_callback(terminate, jingle_file_transfer_terminate_cb,
+			    xfer);
+			jabber_iq_send(terminate);
+		} else {
+			/* the PurpleXfer will get unref:ed after this has finished, so we
+		 	disconnect it to avoid a race-condition if we get here before the
+		 	getting a session-terminate when we are the initiator */
+			JINGLE_FT_GET_PRIVATE(JINGLE_FT(xfer->data))->xfer = NULL;
+			g_object_unref(session);
+			g_object_unref(session);
 		}
-		/* the PurpleXfer will get unref:ed after this has finished, so we
-		 disconnect it to avoid a race-condition if we get here before the
-		 getting a session-terminate when we are the initiator */
-		JINGLE_FT_GET_PRIVATE(JINGLE_FT(xfer->data))->xfer = NULL;
-		g_object_unref(session);
-		g_object_unref(session);
 	}
 }
 
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	73986f7a050b22f5f12cfbf00e32ddf666d5d0b0
+++ libpurple/protocols/jabber/jingle/s5b.c	9b22fc047eeaf7ce4cf8165ed0a264470b0891f7
@@ -1301,6 +1301,7 @@ jingle_s5b_send_proxy_error(gpointer dat
 	JabberIq *proxy_error = jingle_s5b_create_proxy_error(session, s5b);
 
 	jabber_iq_set_callback(proxy_error, jingle_s5b_proxy_error_cb, data);
+	jabber_iq_send(proxy_error);
 }
 
 static gboolean


More information about the Commits mailing list