cpw.malu.xmpp.jingle_ft: 1cdf3188: Only cancel sending when reason code is ...

malu at pidgin.im malu at pidgin.im
Mon Apr 12 15:40:41 EDT 2010


-----------------------------------------------------------------
Revision: 1cdf3188c17ed2b801877e05a3830ec5576bcf94
Ancestor: a1760945192bd1d4dc6cb331a6013d8102d61219
Author: malu at pidgin.im
Date: 2010-04-12T19:36:24
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/1cdf3188c17ed2b801877e05a3830ec5576bcf94

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

ChangeLog: 

Only cancel sending when reason code is not "sucess" on session-terminate

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	a09ff11d9ff3b22e68e241c17a708011e7e6bc93
+++ libpurple/protocols/jabber/jingle/file-transfer.c	0c4d77d100cebfbb3d558df3cbe0b7916110db5a
@@ -792,14 +792,21 @@ jingle_file_transfer_handle_action_inter
 			JingleSession *session = jingle_content_get_session(content);
 			PurpleXfer *xfer = 
 				jingle_file_transfer_get_xfer(content);
-
+			xmlnode *reason = xmlnode_get_child(xmlcontent, "reason");
+			xmlnode *reason_code = reason->child;
+			const gchar *reason_text =
+				reason_code->type == XMLNODE_TYPE_TAG ? reason_code->name : NULL;
+			
 			/* do stuff here... close transfer etc... */
 			if (xfer) {
+				gboolean success = purple_strequal(reason_text, "success");
 				purple_debug_info("jingle-ft", 
-					"got session-terminate, ending transfer %p with content %p\n", 
-					xfer, xfer->data);
-				if (!purple_xfer_is_canceled(xfer))
+					"got session-terminate with reason %s, ending transfer %p with content %p\n", 
+					reason_text, xfer, xfer->data);
+				if (!purple_xfer_is_canceled(xfer) && !success)
 					purple_xfer_cancel_remote(xfer);
+				else if (success)
+					purple_xfer_set_completed(xfer, TRUE);
 				JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer = NULL;
 				xfer->data = NULL;
 			}


More information about the Commits mailing list