soc.2008.vv: 68dc0b9a: Fixed up media functions in prpl.c and p...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Aug 8 23:55:53 EDT 2008


-----------------------------------------------------------------
Revision: 68dc0b9aa0fa25f77e2db49061a4612ee10def6f
Ancestor: b071a312403f7bdec410761990474422c2fea942
Author: maiku at soc.pidgin.im
Date: 2008-08-09T03:11:46
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/68dc0b9aa0fa25f77e2db49061a4612ee10def6f

Modified files:
        libpurple/prpl.c libpurple/prpl.h

ChangeLog: 

Fixed up media functions in prpl.c and prpl.h, adding more documentation and
using PURPLE_PROTOCOL_PLUGIN_HAS_FUNC.

-------------- next part --------------
============================================================
--- libpurple/prpl.c	7543ea25c07786bb8ba6c4ecc48312164bf9bf97
+++ libpurple/prpl.c	8755a6076f9220e3d4b99f2ea2a388a77e469d8b
@@ -494,30 +494,6 @@ purple_prpl_got_attention_in_chat(Purple
 	got_attention(gc, id, who, type_code);
 }
 
-/**************************************************************************
- * Protocol Plugin Subsystem API
- **************************************************************************/
-
-PurplePlugin *
-purple_find_prpl(const char *id)
-{
-	GList *l;
-	PurplePlugin *plugin;
-
-	g_return_val_if_fail(id != NULL, NULL);
-
-	for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) {
-		plugin = (PurplePlugin *)l->data;
-
-		if (!strcmp(plugin->info->id, id))
-			return plugin;
-	}
-
-	return NULL;
-}
-
-
-
 PurpleMedia *
 purple_prpl_initiate_media(PurpleAccount *account,
 			   const char *who,
@@ -535,7 +511,7 @@ purple_prpl_initiate_media(PurpleAccount
 	if (prpl)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	if (prpl_info && prpl_info->initiate_media) {
+	if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, initiate_media)) {
 		/* should check that the protocol supports this media type here? */
 		return prpl_info->initiate_media(gc, who, type);
 	} else {
@@ -563,7 +539,7 @@ purple_prpl_can_do_media(PurpleAccount *
 	if (prpl)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 	
-	if (prpl_info && prpl_info->can_do_media) {
+	if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, can_do_media)) {
 		return prpl_info->can_do_media(gc, who, type);
 	} else {
 		return FALSE;
@@ -573,3 +549,25 @@ purple_prpl_can_do_media(PurpleAccount *
 #endif
 }
 
+/**************************************************************************
+ * Protocol Plugin Subsystem API
+ **************************************************************************/
+
+PurplePlugin *
+purple_find_prpl(const char *id)
+{
+	GList *l;
+	PurplePlugin *plugin;
+
+	g_return_val_if_fail(id != NULL, NULL);
+
+	for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) {
+		plugin = (PurplePlugin *)l->data;
+
+		if (!strcmp(plugin->info->id, id))
+			return plugin;
+	}
+
+	return NULL;
+}
+
============================================================
--- libpurple/prpl.h	86c3d0cfdea68d59e0242d492f5556523389f396
+++ libpurple/prpl.h	3b39a53b03840c27d6353619b063f4aa042f7f1b
@@ -441,10 +441,27 @@ struct _PurplePluginProtocolInfo
 	 */
 	GHashTable *(*get_account_text_table)(PurpleAccount *account);
 
-	/** Initiate media with the given buddy */
-	PurpleMedia  *(*initiate_media)(PurpleConnection *conn, const char *who, PurpleMediaStreamType type);
+	/**
+	 * Initiate a media session with the given contact.
+	 *
+	 * @param conn The connection to initiate the media session on.
+	 * @param who The remote user to initiate the session with.
+	 * @param type The type of media session to initiate.
+	 * @return The newly created media object.
+	 */
+	PurpleMedia  *(*initiate_media)(PurpleConnection *gc, const char *who,
+					PurpleMediaStreamType type);
 
-	gboolean (*can_do_media)(PurpleConnection *conn, const char *who, PurpleMediaStreamType type);
+	/**
+	 * Checks to see if the given contact supports the given type of media session.
+	 *
+	 * @param conn The connection the contact is on.
+	 * @param who The remote user to check for media capability with.
+	 * @param type The type of media session to check for.
+	 * @return @c TRUE The contact supports the given media type, or @c FALSE otherwise.
+	 */
+	gboolean (*can_do_media)(PurpleConnection *gc, const char *who,
+				 PurpleMediaStreamType type);
 };
 
 #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \


More information about the Commits mailing list