cpw.malu.xmpp.jingle_ft: 99115b9a: Actually send a session-terminate when a...

malu at pidgin.im malu at pidgin.im
Thu Apr 16 15:25:30 EDT 2009


-----------------------------------------------------------------
Revision: 99115b9a56a431e5d91ef6db6b074953639687ff
Ancestor: 1a74d1f9851aa32df1b9280746d753966a699d08
Author: malu at pidgin.im
Date: 2009-04-16T19:20:31
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/99115b9a56a431e5d91ef6db6b074953639687ff

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

ChangeLog: 

Actually send a session-terminate when a s5b ft ends.
Only send session-terminate when we are the initiator
Added some comments about adding reason codes for session-terminate on errors

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	444b9b613f9d1545429b7a0a89d50cc607b80055
+++ libpurple/protocols/jabber/jingle/file-transfer.c	024642404a0f7a2bad82d885619efcea2441c9cc
@@ -183,6 +183,7 @@ jingle_file_transfer_cancel_remote(Jingl
 	
 	purple_debug_info("jingle-ft", "cancel remote transfer\n");
 	if (xfer) {
+		/* TODO: set a reason code */
 		jabber_iq_send(jingle_session_to_packet(session, 
 			JINGLE_SESSION_TERMINATE));
 		purple_xfer_cancel_remote(xfer);
@@ -200,6 +201,7 @@ jingle_file_transfer_cancel_local(Jingle
 	
 	purple_debug_info("jingle-ft", "cancel local trasfer\n");
 	if (xfer) {
+		/* TODO: set a reason code */
 		jabber_iq_send(jingle_session_to_packet(session, 
 			JINGLE_SESSION_TERMINATE));
 		purple_xfer_cancel_local(xfer);
@@ -225,15 +227,16 @@ static void
 }
 
 static void
-jingle_file_transfer_end(JingleContent *content)
+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) {
-		jabber_iq_send(jingle_session_to_packet(session, 
-			JINGLE_SESSION_TERMINATE));
+		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);
 	}
@@ -299,7 +302,7 @@ jingle_file_transfer_ibb_data_sent_callb
 
 	if (remaining == 0) {
 		/* close the session */
-		jingle_file_transfer_end(content);
+		jingle_file_transfer_ibb_end(content);
 	} else {
 		/* send more... */
 		jingle_file_transfer_ibb_send_data(content);
@@ -541,6 +544,7 @@ jingle_file_transfer_cancel_recv(PurpleX
 		jingle_content_get_session((JingleContent *)xfer->data);
 
 	purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_recv\n");
+	/* should probably set some reason code here... */
 	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
 	g_object_unref(session);
 	g_object_unref(session);
@@ -552,7 +556,11 @@ jingle_file_transfer_xfer_end(PurpleXfer
 	if (xfer->data) {
 		JingleSession *session = 
 			jingle_content_get_session((JingleContent *)xfer->data);
+		if (jingle_session_is_initiator(session)) {
+			jabber_iq_send(jingle_session_terminate_packet(session, "success"));
+		}
 		g_object_unref(session);
+		g_object_unref(session);
 	}
 }
 
@@ -654,6 +662,7 @@ jingle_file_transfer_handle_action_inter
 						jingle_file_transfer_cancel_recv);
 					purple_xfer_request(xfer);
 				} else {
+					/* TODO: set a reason code */
 					jabber_iq_send(jingle_session_to_packet(session,
 						JINGLE_SESSION_TERMINATE));
 					g_object_unref(session);


More information about the Commits mailing list