cpw.malu.xmpp.google_ft: aeb23285: can now establish a connection with Goog...

malu at pidgin.im malu at pidgin.im
Thu Sep 23 17:25:47 EDT 2010


----------------------------------------------------------------------
Revision: aeb23285e8a80559b1193cc426ba41d10e2d6ae6
Parent:   59c206f14b44ad120c7c131626dad3e069b2c25e
Author:   malu at pidgin.im
Date:     09/23/10 17:20:56
Branch:   im.pidgin.cpw.malu.xmpp.google_ft
URL: http://d.pidgin.im/viewmtn/revision/info/aeb23285e8a80559b1193cc426ba41d10e2d6ae6

Changelog: 

can now establish a connection with Google Talk...

Changes against parent 59c206f14b44ad120c7c131626dad3e069b2c25e

  patched  libpurple/protocols/jabber/google/google_session.c
  patched  libpurple/protocols/jabber/google/google_session.h
  patched  libpurple/protocols/jabber/google/google_share.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google/google_session.c	3a9c554d7b8e6a22c4234bbbb9ffe8b02b48dd63
+++ libpurple/protocols/jabber/google/google_session.c	92bd6c6eddf4555e29ad5b74b21b67f9c3723876
@@ -120,10 +120,11 @@ static void
 }
 
 static void
-google_session_handle_transport_info(JabberStream *js, GoogleSession *session, xmlnode *sess)
+google_session_handle_transport_info(JabberStream *js, GoogleSession *session,
+	xmlnode *sess, const char *iq_id)
 {
 	if (session->handle_transport_info_cb) {
-		session->handle_transport_info_cb(js, session, sess);
+		session->handle_transport_info_cb(js, session, sess, iq_id);
 	}
 }
 
@@ -144,7 +145,7 @@ google_session_parse_iq(JabberStream *js
 	} else if (!strcmp(type, "candidates")) {
 		google_session_handle_candidates(js, session, sess, iq_id);
 	} else if (!strcmp(type, "transport-info")) {
-		google_session_handle_transport_info(js, session, sess);
+		google_session_handle_transport_info(js, session, sess, iq_id);
 	}
 }
 
============================================================
--- libpurple/protocols/jabber/google/google_session.h	ca0693d368f690df983b90e2233fd93512683539
+++ libpurple/protocols/jabber/google/google_session.h	facd7a327ec53f0967095fe59a161218efd9989f
@@ -51,7 +51,7 @@ typedef void (GoogleSessionHandleTranspo
     (JabberStream *js, GoogleSession *session, xmlnode *sess);
 
 typedef void (GoogleSessionHandleTransportInfoCallback)
-    (JabberStream *js, GoogleSession *session, xmlnode *sess);
+    (JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id);
 
 
 struct _GoogleSession {
============================================================
--- libpurple/protocols/jabber/google/google_share.c	e355666f50267cff7b0c993575b6d32144dc8df5
+++ libpurple/protocols/jabber/google/google_share.c	19d1b9aff39e812475215ad86554bcbd06f91594
@@ -37,6 +37,7 @@ typedef struct {
 	gboolean got_relay;		/* this indicates if gotten relay credentials */
 	gboolean old_protocol;
 	gboolean candidate_gathering_done;
+	gboolean channel_created;
 } GoogleShareSessionData;
 
 static void
@@ -46,10 +47,17 @@ static void
 }
 
 static void
+google_share_component_state_changed_cb(NiceAgent *agent, guint stream_id,
+    guint compont_id, guint state, gpointer user_data)
+{
+	purple_debug_info("google-share", "component state changed: state: %d\n", state);
+}
+
+static void
 google_share_writable_cb(NiceAgent *agent, guint stream_id, guint compont_id,
 	gpointer user_data)
 {
-	purple_debug_info("google-share", "tranport writable!\n");
+	purple_debug_info("google-share", "transport writable!\n");
 }
 
 static NiceCandidate *
@@ -106,8 +114,9 @@ google_share_handle_transport_info(Jabbe
 
 static void
 google_share_handle_transport_info(JabberStream *js, GoogleSession *session,
-	xmlnode *sess)
+	xmlnode *sess, const char *iq_id)
 {
+	JabberIq *result;
 	GoogleShareSessionData *session_data =
 		(GoogleShareSessionData *) session->session_data;
 	NiceAgent *agent = session_data->agent;
@@ -140,6 +149,11 @@ google_share_handle_transport_info(Jabbe
 				g_slist_concat(session_data->remote_candidates, candidates);
 		}
 	}
+
+	result = jabber_iq_new(js, JABBER_IQ_RESULT);
+	jabber_iq_set_id(result, iq_id);
+	xmlnode_set_attrib(result->node, "to", session->remote_jid);
+	jabber_iq_send(result);
 }
 
 static xmlnode *
@@ -189,7 +203,7 @@ google_share_create_candidate_node(Googl
 		xmlnode *transport;
 
 		sess = google_session_create_xmlnode(session, "transport-info");
-		transport = xmlnode_new_child(sess, "tranport");
+		transport = xmlnode_new_child(sess, "transport");
 		xmlnode_set_namespace(transport, NS_GOOGLE_TRANSPORT_P2P);
 		xmlnode_insert_child(transport,
 			google_share_nice_candidate_to_xml(candidate,
@@ -253,16 +267,6 @@ google_share_channel_cb(JabberStream *js
 
 		/* start agent */
 		nice_agent_gather_candidates(session_data->agent, session_data->stream_id);
-		/* set up signal */
-		nice_agent_attach_recv(session_data->agent, session_data->stream_id,
-	    	NICE_COMPONENT_TYPE_RTP, g_main_context_default(),
-	    	google_share_data_received_cb, session);
-		g_signal_connect(G_OBJECT(session_data->agent),
-			"candidate-gathering-done",
-	    	G_CALLBACK(google_share_candidate_gathering_done_cb), session);
-		g_signal_connect(G_OBJECT(session_data->agent),
-	    	"reliable-transport-writable",
-	    	G_CALLBACK(google_share_writable_cb), session);
 	}
 }
 	
@@ -328,7 +332,7 @@ google_share_transport_accept_cb(JabberS
 	xmlnode_insert_child(sess, xmlnode_copy(session->description));
 	xmlnode_set_namespace(transport, NS_GOOGLE_TRANSPORT_P2P);
 	jabber_iq_set_callback(iq, google_share_accept_cb, session);
-	jabber_iq_send(iq);	
+	jabber_iq_send(iq);
 }
 
 static void
@@ -397,6 +401,16 @@ google_share_init_agent(GoogleSession *s
 				    NICE_COMPONENT_TYPE_RTP, relay_ip, relay_ssltcp,
 			    	relay_username, relay_password, NICE_RELAY_TYPE_TURN_TLS);
 		}
+
+		/* set up signal */
+		nice_agent_attach_recv(agent, stream_id, NICE_COMPONENT_TYPE_RTP,
+		    g_main_context_default(), google_share_data_received_cb, session);
+		g_signal_connect(G_OBJECT(agent), "candidate-gathering-done",
+	    	G_CALLBACK(google_share_candidate_gathering_done_cb), session);
+		g_signal_connect(G_OBJECT(agent), "reliable-transport-writable",
+	    	G_CALLBACK(google_share_writable_cb), session);
+		g_signal_connect(G_OBJECT(agent), "component-state-changed",
+		    G_CALLBACK(google_share_component_state_changed_cb), session);
 	}
 }
 


More information about the Commits mailing list