comparison libpurple/media.c @ 30522:0f6ef3b21e17

merge of '4e5f78559deacc45eb458cdbe7ffc96491ab11bd' and '97f70a97fe41a0319d0041706ffaf3a6e4f0367d'
author Marcus Lundblad <ml@update.uu.se>
date Sun, 14 Feb 2010 22:42:20 +0000
parents 48f70e888c04 025fe823a921
children ee3226c6092f
comparison
equal deleted inserted replaced
30521:48f70e888c04 30522:0f6ef3b21e17
2752 if (!stream) { 2752 if (!stream) {
2753 GError *err = NULL; 2753 GError *err = NULL;
2754 FsStream *fsstream = NULL; 2754 FsStream *fsstream = NULL;
2755 const gchar *stun_ip = purple_network_get_stun_ip(); 2755 const gchar *stun_ip = purple_network_get_stun_ip();
2756 const gchar *turn_ip = purple_network_get_turn_ip(); 2756 const gchar *turn_ip = purple_network_get_turn_ip();
2757 2757 guint new_num_params =
2758 !stun_ip && !turn_ip ? num_params + 1 :
2759 (stun_ip && is_nice) && turn_ip ?
2760 num_params + 3 : num_params + 2;
2761 guint next_param_index = num_params;
2762 GParameter *param = g_new0(GParameter, new_num_params);
2763
2758 /* check if the prpl has already specified a relay-info 2764 /* check if the prpl has already specified a relay-info
2759 we need to do this to allow them to override when using non-standard 2765 we need to do this to allow them to override when using non-standard
2760 TURN modes, like Google f.ex. */ 2766 TURN modes, like Google f.ex. */
2761 gboolean got_turn_from_prpl = FALSE; 2767 gboolean got_turn_from_prpl = FALSE;
2762 int i; 2768 int i;
2766 got_turn_from_prpl = TRUE; 2772 got_turn_from_prpl = TRUE;
2767 break; 2773 break;
2768 } 2774 }
2769 } 2775 }
2770 2776
2777 memcpy(param, params, sizeof(GParameter) * num_params);
2778
2779 /* set controlling mode according to direction */
2780 param[next_param_index].name = "controlling-mode";
2781 g_value_init(&param[next_param_index].value, G_TYPE_BOOLEAN);
2782 g_value_set_boolean(&param[next_param_index].value, initiator);
2783 next_param_index++;
2784
2771 if (stun_ip || (turn_ip && !got_turn_from_prpl)) { 2785 if (stun_ip || (turn_ip && !got_turn_from_prpl)) {
2772 guint new_num_params =
2773 (stun_ip && is_nice && turn_ip && !got_turn_from_prpl) ?
2774 num_params + 2 : num_params + 1;
2775 guint next_param_index = num_params;
2776 GParameter *param = g_new0(GParameter, new_num_params);
2777 memcpy(param, params, sizeof(GParameter) * num_params);
2778
2779 if (stun_ip) { 2786 if (stun_ip) {
2780 purple_debug_info("media", 2787 purple_debug_info("media",
2781 "setting property stun-ip on new stream: %s\n", stun_ip); 2788 "setting property stun-ip on new stream: %s\n", stun_ip);
2782 2789
2783 param[next_param_index].name = "stun-ip"; 2790 param[next_param_index].name = "stun-ip";