# HG changeset patch # User Marcus Lundblad # Date 1265237182 0 # Node ID 0629b6814963fe27b6282b4f2e57af7dd2141486 # Parent bf0db10b0e3c99e7133a3cd8b7a1fbf285df091e media: Set the "controlling-mode" Farsight2 parameter correctly when creating media streams. Fixes receiving calls from Psi (which needs the receiver to be in non-controlling STUN mode). Closes #11267 diff -r bf0db10b0e3c -r 0629b6814963 ChangeLog --- a/ChangeLog Wed Feb 03 21:34:41 2010 +0000 +++ b/ChangeLog Wed Feb 03 22:46:22 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 diff -r bf0db10b0e3c -r 0629b6814963 libpurple/media.c --- a/libpurple/media.c Wed Feb 03 21:34:41 2010 +0000 +++ b/libpurple/media.c Wed Feb 03 22:46:22 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(¶m[next_param_index].value, G_TYPE_BOOLEAN); + g_value_set_boolean(¶m[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",