changeset 24933:6ab96d5d8ac6

Add params to purple_media_add_stream to allow for different libNice compatibility modes needed for GTalk and MSN.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Mon, 01 Sep 2008 01:23:26 +0000
parents 5606408fff59
children 3b4b9795f987
files libpurple/media.c libpurple/media.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jingle.c
diffstat 4 files changed, 23 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Sun Aug 31 23:27:05 2008 +0000
+++ b/libpurple/media.c	Mon Sep 01 01:23:26 2008 +0000
@@ -1040,7 +1040,8 @@
 purple_media_add_stream_internal(PurpleMedia *media, const gchar *sess_id,
 				 const gchar *who, FsMediaType type,
 				 FsStreamDirection type_direction,
-				 const gchar *transmitter)
+				 const gchar *transmitter,
+				 guint num_params, GParameter *params)
 {
 	PurpleMediaSession *session = purple_media_get_session(media, sess_id);
 	FsParticipant *participant = NULL;
@@ -1115,25 +1116,26 @@
 
 		if (!strcmp(transmitter, "rawudp") &&
 				(stun_ip = purple_media_get_stun_pref_ip())) {
-			GParameter param[2];
-			memset(param, 0, sizeof(GParameter) * 2);
+			GParameter *param = g_new0(GParameter, num_params+2);
+			memcpy(param, params, sizeof(GParameter) * num_params);
 
-			param[0].name = "stun-ip";
-			g_value_init(&param[0].value, G_TYPE_STRING);
-			g_value_take_string(&param[0].value, stun_ip);
+			param[num_params].name = "stun-ip";
+			g_value_init(&param[num_params].value, G_TYPE_STRING);
+			g_value_take_string(&param[num_params].value, stun_ip);
 
-			param[1].name = "stun-timeout";
-			g_value_init(&param[1].value, G_TYPE_UINT);
-			g_value_set_uint(&param[1].value, 5);
+			param[num_params+1].name = "stun-timeout";
+			g_value_init(&param[num_params+1].value, G_TYPE_UINT);
+			g_value_set_uint(&param[num_params+1].value, 5);
 
 			stream = fs_session_new_stream(session->session,
 					participant, type_direction,
-					transmitter, 2, param, &err);
+					transmitter, num_params+2, param, &err);
+			g_free(param);
 			g_free(stun_ip);
 		} else {
 			stream = fs_session_new_stream(session->session,
 					participant, type_direction,
-					transmitter, 0, NULL, &err);
+					transmitter, num_params, params, &err);
 		}
 
 		if (err) {
@@ -1164,7 +1166,8 @@
 gboolean
 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who,
 			PurpleMediaSessionType type,
-			const gchar *transmitter)
+			const gchar *transmitter,
+			guint num_params, GParameter *params)
 {
 	FsStreamDirection type_direction;
 
@@ -1173,7 +1176,7 @@
 
 		if (!purple_media_add_stream_internal(media, sess_id, who,
 						      FS_MEDIA_TYPE_AUDIO, type_direction,
-						      transmitter)) {
+						      transmitter, num_params, params)) {
 			return FALSE;
 		}
 	}
@@ -1182,7 +1185,7 @@
 
 		if (!purple_media_add_stream_internal(media, sess_id, who,
 						      FS_MEDIA_TYPE_VIDEO, type_direction,
-						      transmitter)) {
+						      transmitter, num_params, params)) {
 			return FALSE;
 		}
 	}
--- a/libpurple/media.h	Sun Aug 31 23:27:05 2008 +0000
+++ b/libpurple/media.h	Mon Sep 01 01:23:26 2008 +0000
@@ -345,7 +345,8 @@
  * @return @c TRUE The stream was added successfully, @c FALSE otherwise.
  */
 gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who,
-			     PurpleMediaSessionType type, const gchar *transmitter);
+		PurpleMediaSessionType type, const gchar *transmitter,
+		guint num_params, GParameter *params);
 
 /**
  * Removes a stream from a session.
--- a/libpurple/protocols/jabber/google.c	Sun Aug 31 23:27:05 2008 +0000
+++ b/libpurple/protocols/jabber/google.c	Mon Sep 01 01:23:26 2008 +0000
@@ -218,8 +218,9 @@
 							   "fsrtpconference", session->remote_jid);
 
 	/* "rawudp" will need to be changed to "nice" when libnice is finished */
+	/* GTalk will require the NICE_COMPATIBILITY_GOOGLE param */
 	purple_media_add_stream(session->media, "google-voice", session->remote_jid, 
-				PURPLE_MEDIA_AUDIO, "rawudp");
+				PURPLE_MEDIA_AUDIO, "rawudp", 0, NULL);
 
 	desc_element = xmlnode_get_child(sess, "description");
 	
--- a/libpurple/protocols/jabber/jingle.c	Sun Aug 31 23:27:05 2008 +0000
+++ b/libpurple/protocols/jabber/jingle.c	Mon Sep 01 01:23:26 2008 +0000
@@ -976,13 +976,13 @@
 		if (jabber_jingle_session_content_is_vv_type(jsc, "audio")) {
 			result = purple_media_add_stream(media, "audio-content", remote_jid,
 					purple_media_from_fs(FS_MEDIA_TYPE_AUDIO, direction),
-					"rawudp");
+					"rawudp", 0, NULL);
 			purple_debug_info("jingle", "Created Jingle audio session\n");
 		}
 		else if (jabber_jingle_session_content_is_vv_type(jsc, "video")) {
 			result = purple_media_add_stream(media, "video-content", remote_jid,
 					purple_media_from_fs(FS_MEDIA_TYPE_VIDEO, direction),
-					"rawudp");
+					"rawudp", 0, NULL);
 			purple_debug_info("jingle", "Created Jingle video session\n");
 		}