changeset 28959:3de19f8f5c92

merge of '57bf84117d335fd0bba1edff4c5b3b21e29f6bbc' and '681fb86466372d3d72fbfb554c0b766c81d763e6'
author Marcus Lundblad <ml@update.uu.se>
date Wed, 03 Feb 2010 22:48:03 +0000
parents 452043d200f0 (current diff) 0629b6814963 (diff)
children 99d1b433dba0
files ChangeLog
diffstat 2 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 03 22:19:11 2010 +0000
+++ b/ChangeLog	Wed Feb 03 22:48:03 2010 +0000
@@ -5,6 +5,8 @@
 	* Fix 'make check' on OS X. (David Fang)
 	* Fix a quirk in purple_markup_html_to_xhtml that caused some messages
 	  to be improperly converted to XHTML.
+	* Set "controlling-mode" correctly when initializing a media session.
+	  Fixes receiving voice calls from Psi.
 
 	General:
 	* Correctly disable all missing dependencies when using the
--- a/libpurple/media.c	Wed Feb 03 22:19:11 2010 +0000
+++ b/libpurple/media.c	Wed Feb 03 22:48:03 2010 +0000
@@ -2754,15 +2754,21 @@
 		FsStream *fsstream = NULL;
 		const gchar *stun_ip = purple_network_get_stun_ip();
 		const gchar *turn_ip = purple_network_get_turn_ip();
-
-		if (stun_ip || turn_ip) {
-			guint new_num_params = 
+		guint new_num_params =
+					!stun_ip && !turn_ip ? num_params + 1 :
 					(stun_ip && is_nice) && turn_ip ?
-					num_params + 2 : num_params + 1;
-			guint next_param_index = num_params;
-			GParameter *param = g_new0(GParameter, new_num_params);
-			memcpy(param, params, sizeof(GParameter) * num_params);
-
+					num_params + 3 : num_params + 2;
+		guint next_param_index = num_params;
+		GParameter *param = g_new0(GParameter, new_num_params);
+		memcpy(param, params, sizeof(GParameter) * num_params);
+
+		/* set controlling mode according to direction */
+		param[next_param_index].name = "controlling-mode";
+		g_value_init(&param[next_param_index].value, G_TYPE_BOOLEAN);
+		g_value_set_boolean(&param[next_param_index].value, initiator);
+		next_param_index++;
+		
+		if (stun_ip || turn_ip) {
 			if (stun_ip) {
 				purple_debug_info("media", 
 					"setting property stun-ip on new stream: %s\n", stun_ip);
@@ -2813,20 +2819,14 @@
 					return FALSE;
 				}
 			}
-
-			fsstream = fs_session_new_stream(session->session,
+		}
+
+		fsstream = fs_session_new_stream(session->session,
 					participant, initiator == TRUE ?
 					type_direction : (type_direction &
 					FS_DIRECTION_RECV), transmitter,
 					new_num_params, param, &err);
-			g_free(param);
-		} else {
-			fsstream = fs_session_new_stream(session->session,
-					participant, initiator == TRUE ?
-					type_direction : (type_direction &
-					FS_DIRECTION_RECV), transmitter,
-					num_params, params, &err);
-		}
+		g_free(param);
 
 		if (fsstream == NULL) {
 			purple_debug_error("media",