/soc/2013/ashmew2/filetransferX: fb0c38385f3d: gtalk_xfer_channe...

Ashish Gupta ashmew2 at gmail.com
Mon Aug 19 19:25:51 EDT 2013


Changeset: fb0c38385f3d9cee0c74f4d94e5e8212c3bff007
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-08-20 03:56 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/fb0c38385f3d

Description:

gtalk_xfer_channel_xb added

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  44 ++++++++++++++-------
 1 files changed, 29 insertions(+), 15 deletions(-)

diffs (92 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
@@ -64,7 +64,7 @@ typedef struct {
 	PurpleCircBuffer *buffer; /*Need to add something for HTTP_STATUS too */
 	guint stream_id;
 	GList *remote_share_candidates; /* lists of PurpleMediaCandidate OR NiceCandidates(maybe?)*/
-	GList *local_share_candidates;  
+	GList *local_share_candidates;
 
 } GoogleXferSessionData; 
 /*Thanks malu!*/
@@ -446,8 +446,9 @@ jabber_google_relay_response_session_ini
 
 		if(!share_session->share_agent) {/*TODO: Should probably have an agent_init function for this..Later..*/
 			purple_xfer_request(share_session->xfer);
-
+			
 			agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245);			
+			share_session->share_agent = agent;
 			share_session->stream_id = nice_agent_add_stream(agent, 1);
 			stream_id = share_session->stream_id;
 
@@ -1510,7 +1511,7 @@ cb_candidate_gathering_done(NiceAgent *a
 /*
   guint  stream_id = temp->stream_id;
   NiceAgent *agent = temp->agent;
-*/  
+*/
 	GList *lcands = nice_agent_get_local_candidates(agent, stream_id, 1);
 	char *local_ufrag, *local_password;
 	GoogleSession *session = (GoogleSession *)user_data;
@@ -1520,6 +1521,8 @@ cb_candidate_gathering_done(NiceAgent *a
 				    js->user->node,
 				    js->user->domain,
 				    js->user->resource);
+	purple_debug_info("google_session", "Inside candidate_gather_cb! Now returning..\n");
+	return;
 
 	nice_agent_get_local_credentials(agent, stream_id,
 					 &local_ufrag, &local_password);
@@ -1595,20 +1598,8 @@ char *nice_component_state_to_str(guint 
 void cb_nice_component_state_changed(NiceAgent *agent,guint stream_id, guint component_id,
 				      guint state, gpointer user_data)
 {
-	GoogleXferSessionData *share_session = (GoogleXferSessionData *)user_data;
-
 	purple_debug_info("google_session", "__State of NiceAgent Changed...Current State : [%d]%s.Stream ID: %d", state, nice_component_state_to_str(state), stream_id);
 
-	if(state == NICE_COMPONENT_STATE_CONNECTED) {
-	  
-	  /*		
-			PurpleUtilFetchUrlData *url_data = NULL;
-			gchar *url = g_strdup_printf("http://%s", share_session->source_url);
-		
-			url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, , FALSE,
-			jabber_google_relay_fetch_cb, data);*/
-	}
-	
 }
 
 /*TODO: Add more stuff related to state changes here*/
@@ -2058,6 +2049,29 @@ void gtalk_xfer_send_info(JabberStream *
 }
 
 void
+gtalk_xfer_channel_cb(JabberStream *js, const gchar *from, JabberIqType type, 
+		      const gchar *id, xmlnode *sess, gpointer data)
+{
+	purple_debug_info("google_session", "GTalk responded to our channel send out!\n");
+
+	if (type == JABBER_IQ_RESULT) {
+		GoogleSession *session = (GoogleSession *) data;
+		GoogleAVSessionData *session_data = (GoogleAVSessionData *)session->session_data;
+		GoogleXferSessionData *share_session = session_data->share_session;
+		
+		purple_debug_info("google_session", "Calling gather_candidates() now..\n");
+		/* start agent */
+		if(!share_session->share_agent)
+			purple_debug_info("google_session", "Agent is nULL!\n");
+		else
+			purple_debug_info("google_session", "Agent NOT null..stream id : %d\n",share_session->stream_id);
+
+		nice_agent_gather_candidates(share_session->share_agent, share_session->stream_id);
+		purple_debug_info("google_session", "returned False..");
+	}
+}
+
+void
 gtalk_xfer_accept_cb(JabberStream *js, const gchar *from, JabberIqType type, 
 		     const gchar *id, xmlnode *sess, gpointer data)
 {



More information about the Commits mailing list