/soc/2013/ashmew2/filetransferX: d7b5da1ea976: Added gtalk_xfer_...

Ashish Gupta ashmew2 at gmail.com
Tue Aug 20 19:07:21 EDT 2013


Changeset: d7b5da1ea9769bccc02b7401bb921384ca53d738
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-08-21 00:59 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferX/rev/d7b5da1ea976

Description:

Added gtalk_xfer_init_agent()

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (38 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
@@ -426,6 +426,20 @@ jabber_google_session_get_params(JabberS
 	return new_params;
 }
 
+gint gtalk_xfer_init_agent(GoogleXferSessionData *share_session)
+{
+	gint stream_id;
+	if(!share_session)
+		return -1;
+	if(share_session->share_agent)
+		return share_session->stream_id;
+
+	share_session->agent = nice_agent_new_reliable (g_main_context_default(), NICE_COMPATIBILITY_GOOGLE);
+	stream_id = nice_agent_add_stream(agent, 1);
+	share_session->stream_id = stream_id;
+	return stream_id;
+}
+
 static void
 jabber_google_relay_response_session_initiate_cb(GoogleSession *session,
     const gchar *relay_ip, guint relay_udp, guint relay_tcp, guint relay_ssltcp,
@@ -454,11 +468,8 @@ 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 (g_main_context_default(), NICE_COMPATIBILITY_GOOGLE);			
-			share_session->share_agent = agent;
-			share_session->stream_id = nice_agent_add_stream(agent, 1);
-			stream_id = share_session->stream_id;
+
+			stream_id = gtalk_xfer_init_agent(share_session);
 
 			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);



More information about the Commits mailing list