cpw.malu.xmpp.jingle_ft: f0dcbb7d: Rearranged a bit, removed now unused fun...

malu at pidgin.im malu at pidgin.im
Sun Oct 11 07:52:19 EDT 2009


-----------------------------------------------------------------
Revision: f0dcbb7d22a69defe1f4f1c0242a8ae036e41d18
Ancestor: 29b0a1502d9e11ff8c018b5f1229ea01ef52ff5f
Author: malu at pidgin.im
Date: 2009-10-11T11:48:04
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/f0dcbb7d22a69defe1f4f1c0242a8ae036e41d18

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

ChangeLog: 

Rearranged a bit, removed now unused function.
The g_object_unref warning should now be gone for the initiator when finishing
an IBB transfer

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	a07453470da0fc4287ea8bb1d02d17d4c68f7e6f
+++ libpurple/protocols/jabber/jingle/file-transfer.c	50434ad25094bbfd5f6cbeb2c9d3549ce908d4cd
@@ -195,22 +195,6 @@ jingle_file_transfer_cancel_remote(Jingl
 	g_object_unref(session);	/* actually close the session */
 }
 
-static void
-jingle_file_transfer_ibb_end(JingleContent *content)
-{
-	PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
-	JingleSession *session = jingle_content_get_session(content);
-	
-	purple_debug_info("jingle-ft", "ending transfer\n");
-	if (xfer) {
-		if (jingle_session_is_initiator(session)) {
-			jabber_iq_send(jingle_session_terminate_packet(session, "success"));
-		}
-		purple_xfer_set_completed(xfer, TRUE);
-		purple_xfer_end(xfer);
-	}
-}
-
 static gssize
 jingle_file_transfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer)
 {
@@ -234,7 +218,7 @@ jingle_file_transfer_ibb_data_sent_callb
 
 	if (remaining == 0) {
 		/* close the session */
-		jingle_file_transfer_ibb_end(content);
+		purple_xfer_end(xfer);
 	} else {
 		/* send more... */
 		purple_xfer_prpl_ready(xfer);
@@ -570,13 +554,15 @@ jingle_file_transfer_cancel_send(PurpleX
 		}
 
 		purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_send\n");
-		jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
+		if (purple_xfer_get_bytes_remaining(xfer) != 0) {
+			jabber_iq_send(jingle_session_to_packet(session,
+				JINGLE_SESSION_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
@@ -620,6 +606,7 @@ jingle_file_transfer_xfer_end(PurpleXfer
 		 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);
 	}
 }
 


More information about the Commits mailing list