cpw.malu.xmpp.google_relay: a31927d4: Don't include relay-info in the stream p...

malu at pidgin.im malu at pidgin.im
Fri Sep 25 16:41:26 EDT 2009


-----------------------------------------------------------------
Revision: a31927d4bf8e2ac33b11e700ad434a1ee9770f9b
Ancestor: 654214ec033cd83759eb1fae4d04309951c33982
Author: malu at pidgin.im
Date: 2009-09-25T20:39:08
Branch: im.pidgin.cpw.malu.xmpp.google_relay
URL: http://d.pidgin.im/viewmtn/revision/info/a31927d4bf8e2ac33b11e700ad434a1ee9770f9b

Modified files:
        libpurple/media.c

ChangeLog: 

Don't include relay-info in the stream params if the prpl has already set it
(like Google) since this will allow it use a non-standard relay...

-------------- next part --------------
============================================================
--- libpurple/media.c	3ced467b1ae84265244948b6bc2f13c4f504d0e5
+++ libpurple/media.c	03804c9169790eb954b335d01cd0e130670a31bf
@@ -2719,9 +2719,22 @@ purple_media_add_stream(PurpleMedia *med
 		const gchar *stun_ip = purple_network_get_stun_ip();
 		const gchar *turn_ip = purple_network_get_turn_ip();
 
-		if (stun_ip || turn_ip) {
+		/* check if the prpl has already specified a relay-info
+		 we need to do this to allow them to override when using non-standard
+		 TURN modes, like Google f.ex. */
+		gboolean got_turn_from_prpl = FALSE;
+		int i;
+		
+		for (i = 0 ; i < num_params ; i++) {
+			if (purple_strequal(params[i].name, "relay-info")) {
+				got_turn_from_prpl = TRUE;
+				break;
+			}
+		}
+
+		if (stun_ip || (turn_ip && !got_turn_from_prpl)) {
 			guint new_num_params = 
-					(stun_ip && is_nice) && turn_ip ?
+					(stun_ip && is_nice && turn_ip && !got_turn_from_prpl) ?
 					num_params + 2 : num_params + 1;
 			guint next_param_index = num_params;
 			GParameter *param = g_new0(GParameter, new_num_params);
@@ -2737,7 +2750,7 @@ purple_media_add_stream(PurpleMedia *med
 				next_param_index++;
 			}
 
-			if (turn_ip && is_nice) {
+			if (turn_ip && !got_turn_from_prpl && is_nice) {
 				GValueArray *relay_info = g_value_array_new(0);
 				GValue value;
 				gint turn_port = 


More information about the Commits mailing list