pidgin: 35c36f47: Allow a PRPL to have get_moods return NU...

malu at pidgin.im malu at pidgin.im
Wed Mar 3 17:10:49 EST 2010


-----------------------------------------------------------------
Revision: 35c36f4798530acf3c07ab0acf0c5e7af98c0f48
Ancestor: 85ddef87173c52c6c3d48fafa3cc3a5347dd040d
Author: malu at pidgin.im
Date: 2010-03-03T22:08:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/35c36f4798530acf3c07ab0acf0c5e7af98c0f48

Modified files:
        libpurple/protocols/jabber/usermood.c libpurple/prpl.h
        pidgin/gtkblist.c

ChangeLog: 

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

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/usermood.c	4317c37d99c76294fe16ecdedf98355ff32fa504
+++ libpurple/protocols/jabber/usermood.c	88a9988c83dd4f272a5509c76bbc2a08e136495e
@@ -119,10 +119,6 @@ static PurpleMood moods[] = {
 	{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 @@ PurpleMood *jabber_get_moods(PurpleAccou
 		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
============================================================
--- libpurple/prpl.h	a776b8844260e205c5edf8094fb78c8f899f8531
+++ libpurple/prpl.h	a505829812eb1c6e4a16852811c3c66f4114e36a
@@ -572,7 +572,8 @@ struct _PurplePluginProtocolInfo
 
 	/**
 	 * 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);
 };
============================================================
--- pidgin/gtkblist.c	e7d18e0b764c70b86ad0a08f6ff748dfc69a0087
+++ pidgin/gtkblist.c	8928b4e76884abeca0abd7d6dccaf3ff5158dabb
@@ -8016,8 +8016,10 @@ pidgin_blist_update_accounts_menu(void)
 		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;


More information about the Commits mailing list