maiku.vv: e4b6799c: Add params to purple_media_add_stream to...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sun Aug 31 23:31:00 EDT 2008


-----------------------------------------------------------------
Revision: e4b6799c5bed01a69c70386b75a8f00c003e6713
Ancestor: 8281eefa641005f260bdfe8fe2394b8023678a01
Author: maiku at soc.pidgin.im
Date: 2008-09-01T01:23:26
Branch: im.pidgin.maiku.vv
URL: http://d.pidgin.im/viewmtn/revision/info/e4b6799c5bed01a69c70386b75a8f00c003e6713

Modified files:
        libpurple/media.c libpurple/media.h
        libpurple/protocols/jabber/google.c
        libpurple/protocols/jabber/jingle.c

ChangeLog: 

Add params to purple_media_add_stream to allow for different libNice 
compatibility modes needed for GTalk and MSN.

-------------- next part --------------
============================================================
--- libpurple/media.c	6b352693c69444c9b9130483ddae863379370159
+++ libpurple/media.c	fcc12741590b916e6455be8372619260cea880ee
@@ -1040,7 +1040,8 @@ purple_media_add_stream_internal(PurpleM
 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 @@ purple_media_add_stream_internal(PurpleM
 
 		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 @@ purple_media_add_stream(PurpleMedia *med
 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 @@ purple_media_add_stream(PurpleMedia *med
 
 		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 @@ purple_media_add_stream(PurpleMedia *med
 
 		if (!purple_media_add_stream_internal(media, sess_id, who,
 						      FS_MEDIA_TYPE_VIDEO, type_direction,
-						      transmitter)) {
+						      transmitter, num_params, params)) {
 			return FALSE;
 		}
 	}
============================================================
--- libpurple/media.h	1f5b85519f4c4f950563bff8d3e932590f41b309
+++ libpurple/media.h	c62b9f27f8dc417074f5bc7ec93a83c0de1ffc05
@@ -345,7 +345,8 @@ gboolean purple_media_add_stream(PurpleM
  * @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.
============================================================
--- libpurple/protocols/jabber/google.c	f5084325931895bc511e54b5bbff7099605317b2
+++ libpurple/protocols/jabber/google.c	f78315a466d618f85fb75886d97310f66e5a6274
@@ -218,8 +218,9 @@ google_session_handle_initiate(JabberStr
 							   "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");
 	
============================================================
--- libpurple/protocols/jabber/jingle.c	8501eb4aeff8cd86bd131aa3933584219fddec7c
+++ libpurple/protocols/jabber/jingle.c	51a4b183856c832218e30c22c6e54297357e4f0d
@@ -976,13 +976,13 @@ jabber_jingle_session_initiate_media_int
 		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");
 		}
 


More information about the Commits mailing list