cpw.rekkanoryo.icqxstatus: 88e86148: Show the translated mood message (again)...

malu at pidgin.im malu at pidgin.im
Tue Feb 9 17:11:17 EST 2010


-----------------------------------------------------------------
Revision: 88e861487c0bb038a99ebb6d7675ae45f749e799
Ancestor: c9735a4e7922385cf7d662443dcb87cfcb72df10
Author: malu at pidgin.im
Date: 2010-02-09T22:07:48
Branch: im.pidgin.cpw.rekkanoryo.icqxstatus
URL: http://d.pidgin.im/viewmtn/revision/info/88e861487c0bb038a99ebb6d7675ae45f749e799

Modified files:
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

Show the translated mood message (again), if it matches one of the moods we
know about.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	dd40318031d3f1521ca2207113593960b292a6f1
+++ libpurple/protocols/jabber/jabber.c	aedf5ce989c9d7d61a0bbafaf1ff94c8855c00e4
@@ -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 @@ void jabber_tooltip_text(PurpleBuddy *b,
 			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");


More information about the Commits mailing list