Allow a PRPL to have get_moods return NULL to disable mood setting.

Wed, 03 Mar 2010 22:08:27 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Wed, 03 Mar 2010 22:08:27 +0000
changeset 29803
278d6c622f5d
parent 29788
cb8663d9a5f9
child 29804
9b7212a03304

Allow a PRPL to have get_moods return NULL to disable mood setting.
Fixes not showing the "Set Mood" menu for XMPP accounts not supporting PEP
such as gmail.com

libpurple/protocols/jabber/usermood.c file | annotate | diff | comparison | revisions
libpurple/prpl.h file | annotate | diff | comparison | revisions
pidgin/gtkblist.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/usermood.c	Sun Feb 28 22:30:02 2010 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Wed Mar 03 22:08:27 2010 +0000
@@ -119,10 +119,6 @@
 	{NULL, NULL, NULL}
 };
 
-static PurpleMood empty_moods[] = {
-	{NULL, NULL, NULL}
-};
-
 static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) {
 	/* it doesn't make sense to have more than one item here, so let's just pick the first one */
 	xmlnode *item = xmlnode_get_child(items, "item");
@@ -268,6 +264,6 @@
 		return moods;
 	} else {
 		purple_debug_info("jabber", "get_moods: account doesn't support PEP\n");
-		return empty_moods;
+		return NULL;
 	}
 }
\ No newline at end of file
--- a/libpurple/prpl.h	Sun Feb 28 22:30:02 2010 +0000
+++ b/libpurple/prpl.h	Wed Mar 03 22:08:27 2010 +0000
@@ -572,7 +572,8 @@
 
 	/**
 	 * Returns an array of "PurpleMood"s, with the last one having
-	 * "mood" set to @c NULL.
+	 * "mood" set to @c NULL, or NULL if the account does not support setting
+	 * a mood.
 	 */
 	PurpleMood *(*get_moods)(PurpleAccount *account);
 };
--- a/pidgin/gtkblist.c	Sun Feb 28 22:30:02 2010 +0000
+++ b/pidgin/gtkblist.c	Wed Mar 03 22:08:27 2010 +0000
@@ -8016,8 +8016,10 @@
 		if (prpl_info &&
 		    (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) ||
 			 PURPLE_PLUGIN_HAS_ACTIONS(plugin))) {
-			if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods)) {
+			if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) &&
+			    prpl_info->get_moods(account) != NULL) {
 				GList *types;
+
 				for (types = purple_account_get_status_types(account);
 			     	types != NULL ; types = types->next) {
 					PurpleStatusType *type = types->data;

mercurial