changeset 29529:3e5bb4e2334c

Added PurpleConnection flags to determine support for moods and mood messages. Mood messages is yet to be implemented in the UI (and replacing the current account-specific mood setting for XMPP).
author Marcus Lundblad <ml@update.uu.se>
date Thu, 04 Mar 2010 22:14:03 +0000
parents cead5610c89a
children 9f6a657af957
files libpurple/connection.h libpurple/protocols/jabber/disco.c libpurple/protocols/oscar/oscar.c pidgin/gtkblist.c
diffstat 4 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.h	Thu Mar 04 21:25:50 2010 +0000
+++ b/libpurple/connection.h	Thu Mar 04 22:14:03 2010 +0000
@@ -44,8 +44,9 @@
 	PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
 	PURPLE_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */
 	PURPLE_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
-	PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100 /**< Connection supports sending and receiving custom smileys */
-	
+	PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100, /**< Connection supports sending and receiving custom smileys */
+	PURPLE_CONNECTION_SUPPORT_MOODS = 0x0200, /**< Connection supports setting moods */
+	PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES = 0x0400 /**< Connection supports setting a message on moods */
 } PurpleConnectionFlags;
 
 typedef enum
--- a/libpurple/protocols/jabber/disco.c	Thu Mar 04 21:25:50 2010 +0000
+++ b/libpurple/protocols/jabber/disco.c	Thu Mar 04 22:14:03 2010 +0000
@@ -517,8 +517,12 @@
 		const char *category, *type, *name;
 		category = xmlnode_get_attrib(child, "category");
 		type = xmlnode_get_attrib(child, "type");
-		if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep"))
+		if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) {
+			PurpleConnection *gc = js->gc;
 			js->pep = TRUE;
+			gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS |
+				PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES;
+		}
 		if (!category || strcmp(category, "server"))
 			continue;
 		if (!type || strcmp(type, "im"))
--- a/libpurple/protocols/oscar/oscar.c	Thu Mar 04 21:25:50 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Mar 04 22:14:03 2010 +0000
@@ -1573,6 +1573,7 @@
 
 	if (oscar_util_valid_name_icq((purple_account_get_username(account)))) {
 		od->icq = TRUE;
+		gc->flags |= PURPLE_CONNECTION_SUPPORT_MOODS;
 	} else {
 		gc->flags |= PURPLE_CONNECTION_HTML;
 		gc->flags |= PURPLE_CONNECTION_AUTO_RESP;
--- a/pidgin/gtkblist.c	Thu Mar 04 21:25:50 2010 +0000
+++ b/pidgin/gtkblist.c	Thu Mar 04 22:14:03 2010 +0000
@@ -8017,7 +8017,7 @@
 		    (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) ||
 			 PURPLE_PLUGIN_HAS_ACTIONS(plugin))) {
 			if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) &&
-			    prpl_info->get_moods(account) != NULL) {
+			    gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) {
 				GList *types;
 
 				for (types = purple_account_get_status_types(account);