/soc/2013/ashmew2/filetransferY: 7545f393ca99: Added state chang...

Ashish Gupta ashmew2 at gmail.com
Sun Dec 22 04:25:22 EST 2013


Changeset: 7545f393ca999f6e4b83d44d486e08f3d601873c
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-12-22 12:22 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferY/rev/7545f393ca99

Description:

Added state changes. Fixed internal-server-error Crash

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (77 lines):

diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -121,7 +121,8 @@ google_session_destroy(GoogleSession *se
 	GoogleAVSessionData *session_data =
 		(GoogleAVSessionData *) session->session_data;
 	JabberStream *js = session->js;
-	
+
+	session->state = TERMINATED;	
 	purple_debug_info("google_session", "Inside google_session_destroy..\n\n");
 
 	if(!session_data)
@@ -138,7 +139,7 @@ google_session_destroy(GoogleSession *se
 		purple_debug_info("gs_", "status of xfer : %d",purple_xfer_get_status(share_session->xfer) == PURPLE_XFER_STATUS_STARTED);
 		TODO: Add various status changes when cancelling Xfers so that the following section can make use of it.
 		*/
-
+		
 		if(share_session->xfer)	{
 			if(purple_xfer_get_status(share_session->xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE)
 				purple_xfer_cancel_remote(share_session->xfer);
@@ -873,8 +874,7 @@ google_session_handle_initiate(JabberStr
 
 	if (session->state != UNINIT) {
 		purple_debug_error("jabber", "Received initiate for active session.\n");
-		return FALSE;
-		
+		return FALSE;		
 	}
 	
 	session->description = xmlnode_copy(xmlnode_get_child(sess, "description"));
@@ -933,7 +933,7 @@ google_session_handle_initiate(JabberStr
 				session->js->user->node,
 				session->js->user->domain,
 				session->js->user->resource);
-
+		
 		purple_debug_info("google_session", "Indeed a SHARE Session\n");
 		if( description ) {
 			purple_debug_info("google_session", "description is not NULL");
@@ -1021,7 +1021,7 @@ google_session_handle_initiate(JabberStr
 		}
 		/*Ask the user to accept the file transfer*/
 		purple_xfer_request(share_session->xfer);
-
+		session->state = RECEIVED_INITIATE;
 		return TRUE;
 	}
 	return TRUE;	
@@ -1184,8 +1184,9 @@ google_session_handle_transport_accept(J
 	JabberIq *result_iq = jabber_iq_new(js,JABBER_IQ_RESULT);
 	purple_debug_info("google_session", "Inside handle_transport_accept()\n");
 	xmlnode_set_attrib(result_iq->node, "to", session->remote_jid);
-	jabber_iq_set_id(result_iq, iq_id);
+	jabber_iq_set_id(result_iq, iq_id);	
 	jabber_iq_send(result_iq);
+	session->state = IN_PROGRESS;
 }
 
 NiceCandidate *
@@ -2248,6 +2249,7 @@ void gtalk_xfer_send_session_initiate(Pu
 	jabber_iq_set_callback(iq, gtalk_xfer_send_initiate_cb, session);
 	jabber_iq_send(iq);
 	purple_debug_info("google_session", "Initiate SENT!");
+	session->state = SENT_INITIATE;
 
 }
 
@@ -2445,6 +2447,7 @@ gtalk_xfer_send_transport_accept(JabberS
 	xmlnode_set_namespace(transport_node, NS_GOOGLE_TRANSPORT_P2P);
 	jabber_iq_set_callback(iq, gtalk_xfer_transport_accept_cb, session);
 	jabber_iq_send(iq);
+	session->state = IN_PROGRESS;
 }
 
 static void



More information about the Commits mailing list