changeset 29471:1140ced9b4f6

merge of '88e861487c0bb038a99ebb6d7675ae45f749e799' and 'c7a31c2a657883fbaf9577a5d0fd7c2b7731e207'
author Paul Aurich <paul@darkrain42.org>
date Tue, 09 Feb 2010 22:39:08 +0000
parents b052a711cfbd (diff) d780d89dc079 (current diff)
children 5b1b7c5393f6
files
diffstat 8 files changed, 77 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Feb 09 22:38:47 2010 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Feb 09 22:39:08 2010 +0000
@@ -62,6 +62,7 @@
 #include "roster.h"
 #include "ping.h"
 #include "si.h"
+#include "usermood.h"
 #include "xdata.h"
 #include "pep.h"
 #include "adhoccommands.h"
@@ -2062,14 +2063,27 @@
 			mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
 			if(mood && *mood) {
 				const char *moodtext;
+				/* find the mood */
+				PurpleMood *moods = jabber_get_moods(account);
+				const char *description = NULL;
+
+				for (; moods->mood ; moods++) {
+					if (purple_strequal(moods->mood, mood)) {
+						description = moods->description;
+						break;
+					}
+				}
+
 				moodtext = purple_status_get_attr_string(status, PURPLE_MOOD_COMMENT);
 				if(moodtext && *moodtext) {
-					char *moodplustext = g_strdup_printf("%s (%s)", mood, moodtext);
+					char *moodplustext =
+						g_strdup_printf("%s (%s)", description ? _(description) : mood, moodtext);
 
 					purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext);
 					g_free(moodplustext);
 				} else
-					purple_notify_user_info_add_pair(user_info, _("Mood"), mood);
+					purple_notify_user_info_add_pair(user_info, _("Mood"), 
+					    description ? _(description) : mood);
 			}
 			if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) {
 				PurpleStatus *tune = purple_presence_get_status(presence, "tune");
@@ -2132,6 +2146,14 @@
 			NULL);
 	types = g_list_prepend(types, type);
 
+	
+	type = purple_status_type_new_with_attrs(PURPLE_STATUS_MOOD,
+	    "mood", NULL, TRUE, TRUE, TRUE,
+			PURPLE_MOOD_NAME, _("Mood Name"), purple_value_new(PURPLE_TYPE_STRING),
+			PURPLE_MOOD_COMMENT, _("Mood Comment"), purple_value_new(PURPLE_TYPE_STRING),
+			NULL);
+	types = g_list_prepend(types, type);
+
 	priority_value = purple_value_new(PURPLE_TYPE_INT);
 	purple_value_set_int(priority_value, 1);
 	buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN);
--- a/libpurple/protocols/jabber/libxmpp.c	Tue Feb 09 22:38:47 2010 +0000
+++ b/libpurple/protocols/jabber/libxmpp.c	Tue Feb 09 22:39:08 2010 +0000
@@ -43,6 +43,7 @@
 #include "presence.h"
 #include "google.h"
 #include "pep.h"
+#include "usermood.h"
 #include "usertune.h"
 #include "caps.h"
 #include "data.h"
@@ -126,7 +127,7 @@
 	NULL, /* get_account_text_table */
 	jabber_initiate_media,          /* initiate_media */
 	jabber_get_media_caps,                  /* get_media_caps */
-	NULL  							/* get_moods */
+	jabber_get_moods  							/* get_moods */
 };
 
 static gboolean load_plugin(PurplePlugin *plugin)
--- a/libpurple/protocols/jabber/usermood.c	Tue Feb 09 22:38:47 2010 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Tue Feb 09 22:39:08 2010 +0000
@@ -119,6 +119,10 @@
 	{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");
@@ -156,7 +160,7 @@
 	}
 	if (newmood != NULL) {
 		purple_prpl_got_user_status(js->gc->account, from, "mood",
-				PURPLE_MOOD_NAME, mood,
+				PURPLE_MOOD_NAME, newmood,
 				PURPLE_MOOD_COMMENT, moodtext,
 				NULL);
 	} else {
@@ -252,3 +256,17 @@
 	/* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free
 	   (yay for well-defined memory management rules) */
 }
+
+PurpleMood *jabber_get_moods(PurpleAccount *account)
+{
+	PurpleConnection *gc = purple_account_get_connection(account);
+	JabberStream *js = (JabberStream *) gc->proto_data;
+
+	if (js->pep) {
+		purple_debug_info("jabber", "get_moods: account supports PEP\n");
+		return moods;
+	} else {
+		purple_debug_info("jabber", "get_moods: account doesn't support PEP\n");
+		return empty_moods;
+	}
+}
\ No newline at end of file
--- a/libpurple/protocols/jabber/usermood.h	Tue Feb 09 22:38:47 2010 +0000
+++ b/libpurple/protocols/jabber/usermood.h	Tue Feb 09 22:39:08 2010 +0000
@@ -36,4 +36,6 @@
 		     const char *mood, /* must be one of the valid strings defined in the XEP */
 		     const char *text /* might be NULL */);
 
+PurpleMood *jabber_get_moods(PurpleAccount *account);
+
 #endif /* PURPLE_JABBER_USERMOOD_H_ */
--- a/libpurple/protocols/oscar/oscar.c	Tue Feb 09 22:38:47 2010 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Tue Feb 09 22:39:08 2010 +0000
@@ -6199,8 +6199,6 @@
 			return "admin";
 		if (userinfo->flags & AIM_FLAG_ACTIVEBUDDY)
 			return "bot";
-		if (userinfo->capabilities & OSCAR_CAPABILITY_HIPTOP)
-			return "hiptop";
 		if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM)
 			return "secure";
 		if (userinfo->icqinfo.status & AIM_ICQ_STATE_BIRTHDAY)
--- a/pidgin/gtkblist.c	Tue Feb 09 22:38:47 2010 +0000
+++ b/pidgin/gtkblist.c	Tue Feb 09 22:39:08 2010 +0000
@@ -8150,38 +8150,36 @@
 
 		gc = purple_account_get_connection(account);
 		plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL;
-
-		if (plugin &&
-		    (prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin)) &&
-		    PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods))
-		{
-			GList *types;
-			for (types = purple_account_get_status_types(account);
-			     types != NULL ; types = types->next)
-			{
-				PurpleStatusType *type = types->data;
-
-				if (strcmp(purple_status_type_get_id(type), "mood") != 0)
-					continue;
-
-				menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood..."));
-				g_signal_connect(G_OBJECT(menuitem), "activate",
-					         G_CALLBACK(set_mood_cb), account);
-				gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
-
-				/* Be safe.  It shouldn't match more than once anyway */
-				break;
+		prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL;
+		
+		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)) {
+				GList *types;
+				for (types = purple_account_get_status_types(account);
+			     	types != NULL ; types = types->next) {
+					PurpleStatusType *type = types->data;
+
+					if (strcmp(purple_status_type_get_id(type), "mood") != 0)
+						continue;
+
+					menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood..."));
+					g_signal_connect(G_OBJECT(menuitem), "activate",
+					         	G_CALLBACK(set_mood_cb), account);
+					gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
+
+					/* Be safe.  It shouldn't match more than once anyway */
+					break;
+				}
 			}
-		}
-		else
-		{
-			if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
+			if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
 				build_plugin_actions(submenu, plugin, gc);
-			} else {
-				menuitem = gtk_menu_item_new_with_label(_("No actions available"));
-				gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
-				gtk_widget_set_sensitive(menuitem, FALSE);
 			}
+		} else {
+			menuitem = gtk_menu_item_new_with_label(_("No actions available"));
+			gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
+			gtk_widget_set_sensitive(menuitem, FALSE);
 		}
 
 		pidgin_separator(submenu);
--- a/pidgin/pixmaps/Makefile.am	Tue Feb 09 22:38:47 2010 +0000
+++ b/pidgin/pixmaps/Makefile.am	Tue Feb 09 22:39:08 2010 +0000
@@ -118,8 +118,6 @@
 		emblems/scalable/free-for-chat.svg \
 		emblems/scalable/game.svg \
 		emblems/scalable/male.svg \
-		emblems/scalable/mobile.svg \
-		emblems/scalable/music.svg \
 		emblems/scalable/not-authorized.svg \
 		emblems/scalable/qq-member.svg \
 		emblems/scalable/secure.svg \
--- a/pidgin/pixmaps/emotes/small/16/Makefile.am	Tue Feb 09 22:38:47 2010 +0000
+++ b/pidgin/pixmaps/emotes/small/16/Makefile.am	Tue Feb 09 22:39:08 2010 +0000
@@ -1,7 +1,10 @@
 # These are mood images that are NOT also used in the smiley theme.
 MOODS = \
+    afraid.png \
     bathing.png \
     cinema.png \
+    disappointed.png \
+    embarrassed.png \
     internet.png \
     music.png \
     restroom.png \