diff libpurple/server.c @ 25637:92e71f6e10d4

Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp. It's now possible to initiate an audio session, sometimes. It's somewhat buggy. Some other issues also need to be resolved: * Properly get rid of the compile warnings * Rename the serv_ functions with proper namespacing. * Possibly rename the purple_media_ functions that don't deal with a PurpleMedia (e.g. purple_media_audio_init_src) to something different, e.g. purple_media_util_, or even purple_gst_util etc.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 22 Mar 2008 04:45:46 +0000
parents 3232cc79fa51
children befeece4dd48
line wrap: on
line diff
--- a/libpurple/server.c	Tue Mar 18 05:40:29 2008 +0000
+++ b/libpurple/server.c	Sat Mar 22 04:45:46 2008 +0000
@@ -37,6 +37,9 @@
 #include "server.h"
 #include "status.h"
 #include "util.h"
+#ifdef USE_FARSIGHT
+#include "media.h"
+#endif
 
 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600
 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married"
@@ -1040,3 +1043,45 @@
 		}
 	}
 }
+
+#ifdef USE_FARSIGHT
+PurpleMedia *serv_initiate_media(PurpleConnection *gc, const char *who,
+								 PurpleMediaStreamType type)
+{
+	PurplePlugin *prpl = NULL;
+	PurplePluginProtocolInfo *prpl_info = NULL;
+	
+	if (gc)
+		prpl = purple_connection_get_prpl(gc);
+	if (prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+	
+	if (prpl_info && prpl_info->initiate_media) {
+		/* should check that the protol supports this media type here.... */
+		return prpl_info->initiate_media(gc, who, type);
+	} else {
+		return NULL;
+	}
+}
+
+gboolean
+serv_can_do_media(PurpleConnection *gc, const char *who, 
+                  PurpleMediaStreamType type)
+{
+    PurplePlugin *prpl = NULL;
+	PurplePluginProtocolInfo *prpl_info = NULL;
+	
+	if (gc)
+		prpl = purple_connection_get_prpl(gc);
+	if (prpl)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+	
+	if (prpl_info && prpl_info->can_do_media) {
+		/* should check that the protol supports this media type here.... */
+		return prpl_info->can_do_media(gc, who, type);
+	} else {
+		return FALSE;
+	}
+}
+    
+#endif