libpurple/protocols/jabber/jabber.c

branch
cpw.malu.xmpp.google_relay
changeset 28594
3e438648a895
parent 28583
03f8fee2908a
parent 28570
3f2c959e511c
child 28597
0e06c97202e9
--- a/libpurple/protocols/jabber/jabber.c	Mon Sep 28 18:11:28 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Sep 28 18:14:06 2009 +0000
@@ -842,6 +842,9 @@
 	js->stun_ip = NULL;
 	js->stun_port = 0;
 	js->stun_query = NULL;
+	js->google_relay_token = NULL;
+	js->google_relay_host = NULL;
+	js->google_relay_request = NULL;
 
 	/* if we are idle, set idle-ness on the stream (this could happen if we get
 		disconnected and the reconnects while being idle. I don't think it makes
@@ -1563,6 +1566,19 @@
 		js->stun_query = NULL;
 	}
 
+	/* remove Google relay-related stuff */
+	g_free(js->google_relay_token);
+	g_free(js->google_relay_host);
+	if (js->google_relay_request) {
+		purple_util_fetch_url_cancel(js->google_relay_request);
+		js->google_relay_request = NULL;
+	}
+
+	if (js->google_relay_request != NULL) {
+		purple_util_fetch_url_cancel(js->google_relay_request);
+		js->google_relay_request = NULL;
+	}
+
 	g_free(js);
 
 	gc->proto_data = NULL;
@@ -3012,10 +3028,11 @@
 		jbr = jabber_buddy_find_resource(jb, resource);
 		g_free(resource);
 
-		if (type & PURPLE_MEDIA_AUDIO &&
-				!jabber_resource_has_capability(jbr,
-				JINGLE_APP_RTP_SUPPORT_AUDIO) &&
-				jabber_resource_has_capability(jbr,
+		/* if we are on a Google Talk connection and the remote supports
+		 Google Jingle, we will go with that */
+		if ((js->googletalk || 
+		     !jabber_resource_has_capability(jbr, JINGLE_APP_RTP_SUPPORT_AUDIO))
+		    && type & PURPLE_MEDIA_AUDIO && jabber_resource_has_capability(jbr,
 				GOOGLE_VOICE_CAP))
 			return jabber_google_session_initiate(js, who, type);
 		else

mercurial