/soc/2013/ashmew2/filetransferX: 9bbeb3d2c49b: Editing relay_cal...

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


Changeset: 9bbeb3d2c49b8b30d90ee5f3a1694b86891eb1d0
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-08-20 02:10 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/9bbeb3d2c49b

Description:

Editing relay_callback() for gtalk receive

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  47 ++++++++++++++++++---
 1 files changed, 39 insertions(+), 8 deletions(-)

diffs (73 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
@@ -60,13 +60,13 @@ typedef struct {
 	NiceAgent *share_agent; /*TODO : Assess the usefulness of share_agent and stream_id*/
 	ShareChannel *share_channel;
 	NiceComponentState agent_state;
-	PurpleCircBuffer *buffer;
+	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;  
 
 } GoogleXferSessionData; 
-/*Thanks to malu*/
+/*Thanks malu!*/
 
 typedef struct {
 	NiceAgent *agent;
@@ -436,16 +436,47 @@ jabber_google_relay_response_session_ini
 		agent = share_session->share_agent;
 
 		if(!share_session->share_agent) {
-			agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245);
+			agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245);			
+			share_session->stream_id = nice_agent_add_stream(agent, 1);
+			stream_id = share_session->stream_id;
+
+			purple_debug_info("google_session", "share_agent is NULL in relab_cb!\n");
+			purple_debug_info("google_session", "Value of stream_id : %d\n",share_session->stream_id);
+			
+			if(js->stun_ip) {
+				purple_debug_info("google_session", "Setting Agent's STUN..");
+				g_object_set(G_OBJECT (agent), "stun-server", js->stun_ip, NULL);
+				g_object_set(G_OBJECT (agent), "stun-server-port", js->stun_port, NULL);
+			}
+
+			if (relay_ip) {
+				purple_debug_info("google_session", "Setting relay stuff on the agent\n");
+				if (relay_udp)
+					nice_agent_set_relay_info(agent, share_session->stream_id, 1, relay_ip, relay_udp,
+								  relay_username, relay_password, NICE_RELAY_TYPE_TURN_UDP);
+				if (relay_tcp)
+					nice_agent_set_relay_info(agent, share_session->stream_id, 1, relay_ip, relay_tcp,
+								  relay_username, relay_password, NICE_RELAY_TYPE_TURN_TCP);
+				if (relay_ssltcp)
+					nice_agent_set_relay_info(agent, share_session->stream_id, 1, relay_ip, relay_ssltcp,
+								  relay_username, relay_password, NICE_RELAY_TYPE_TURN_TLS);
+			}
+
+			nice_agent_attach_recv(agent, stream_id, 1, g_main_context_default(),
+					       google_share_data_received_cb, session);
+			g_signal_connect(G_OBJECT(agent), "candidate-gathering-done",
+					 G_CALLBACK(cb_candidate_gathering_done), session);
+			g_signal_connect(G_OBJECT(agent), "reliable-transport-writable",
+					 G_CALLBACK(cb_nice_component_writable), session);
+			g_signal_connect(G_OBJECT(agent), "component-state-changed",
+					 G_CALLBACK(cb_nice_component_state_changed), session);
 			/*Add relay candidates to our candidate list?*/
 /*		            * candidate address='49.248.181.68' port='46448' username='HKmLfAkZB81f7r8x' password='' preference='0.000000' protocol='udp' type='stun' component='1' network='0' generation='0' name='private-1'
  */
-			purple_debug_info("google_session", "share_agent is NULL in relab_cb!\n");
-			share_session->share_agent = agent;
-			stream_id = nice_agent_add_stream (agent, 1);
-			share_session->stream_id = stream_id;
+			purple_debug_info("google_session", "share_agent is NULL in relab_cb! Returning..\n");
 /*Set up other stuff for NiceAgent TODO*/
-			
+/*TODO : Return for now, trying to receive a file from GTalk, otherwise we went on with the relay_candidate_* set up..*/
+			return;
 		}
 		else {
 			purple_debug_info("google_session", "share_agent is NOT NULL\n");



More information about the Commits mailing list