changeset 30933:2bb3936d2f1e

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...
author Marcus Lundblad <ml@update.uu.se>
date Fri, 25 Sep 2009 20:39:08 +0000
parents f858b53dfbf0
children bcf1e4fe2a89
files libpurple/media.c
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Thu Sep 24 20:22:24 2009 +0000
+++ b/libpurple/media.c	Fri Sep 25 20:39:08 2009 +0000
@@ -2719,9 +2719,22 @@
 		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 @@
 				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 =