changeset 26454:9131368ba4be

Advertise ICEUDP only when libnice is available
author Paul Aurich <paul@darkrain42.org>
date Sat, 04 Apr 2009 06:15:58 +0000
parents ecf6fd808d23
children 3613804b8f8d a9d5067ad6e7
files libpurple/media.c libpurple/media.h libpurple/protocols/jabber/jabber.c
diffstat 3 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Sat Apr 04 05:50:34 2009 +0000
+++ b/libpurple/media.c	Sat Apr 04 06:15:58 2009 +0000
@@ -40,6 +40,7 @@
 #ifdef USE_VV
 
 #include <gst/farsight/fs-conference-iface.h>
+#include <gst/farsight/fs-transmitter.h>
 
 /** @copydoc _PurpleMediaSession */
 typedef struct _PurpleMediaSession PurpleMediaSession;
@@ -3057,3 +3058,26 @@
 #endif
 }
 
+gboolean
+purple_media_transmitter_exists(const gchar *transmitter)
+{
+#ifdef USE_VV
+	char **transmitters;
+	int i;
+
+	g_return_val_if_fail(transmitter != NULL, FALSE);
+
+	transmitters = fs_transmitter_list_available();
+	for (i = 0; transmitters[i]; ++i) {
+		if (g_str_equal(transmitter, transmitters[i])) {
+			g_strfreev(transmitters);
+			return TRUE;
+		}
+	}
+
+	g_strfreev(transmitters);
+	return FALSE;
+#else
+	return FALSE;
+#endif
+}
--- a/libpurple/media.h	Sat Apr 04 05:50:34 2009 +0000
+++ b/libpurple/media.h	Sat Apr 04 06:15:58 2009 +0000
@@ -597,6 +597,15 @@
  */
 void purple_media_remove_output_windows(PurpleMedia *media);
 
+/**
+ * Returns whether or not a specific transmitter type is present.
+ *
+ * @param transmitter The name of the transmitter.
+ *
+ * @return TRUE if it is present, FALSE otherwise.
+ */
+gboolean purple_media_transmitter_exists(const gchar *transmitter);
+
 #ifdef __cplusplus
 }
 #endif
--- a/libpurple/protocols/jabber/jabber.c	Sat Apr 04 05:50:34 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat Apr 04 06:15:58 2009 +0000
@@ -2748,6 +2748,12 @@
 	return (caps & (PURPLE_MEDIA_CAPS_VIDEO | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION));
 }
 
+static gboolean
+feature_ice_transmitter_present(JabberStream *js, const char *namespace)
+{
+	return purple_media_transmitter_exists("nice");
+}
+
 typedef struct {
 	PurpleConnection *pc;
 	gchar *who;
@@ -3181,12 +3187,13 @@
 	/* Jingle features! */
 	jabber_add_feature(JINGLE, 0);
 	jabber_add_feature(JINGLE_TRANSPORT_RAWUDP, 0);
-	jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, 0);
+
 #ifdef USE_VV
 	jabber_add_feature("http://www.google.com/xmpp/protocol/session", feature_audio_enabled);
 	jabber_add_feature("http://www.google.com/xmpp/protocol/voice/v1", feature_audio_enabled);
 	jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, feature_audio_enabled);
 	jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, feature_video_enabled);
+	jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, feature_ice_transmitter_present);
 #endif
 
 	/* IPC functions */