changeset 29916:6bcf405d5c63

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
author Marcus Lundblad <ml@update.uu.se>
date Wed, 03 Mar 2010 22:08:27 +0000
parents 27a94015e239
children f33da955a815
files libpurple/protocols/jabber/usermood.c libpurple/prpl.h pidgin/gtkblist.c
diffstat 3 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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;