changeset 17846:2f067d8fb19a

Fixed a few small mistakes I discovered while testing user mood in Adium.
author Andreas Monitzer <pidgin@monitzer.com>
date Tue, 12 Jun 2007 03:19:42 +0000
parents 2e0799b916b9
children 267f614152c4
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/message.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/usermood.c
diffstat 4 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Jun 12 01:25:46 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Jun 12 03:19:42 2007 +0000
@@ -1192,6 +1192,9 @@
 		GList *l;
 
 		if (full) {
+			PurpleStatus *status;
+			PurpleValue *value;
+			
 			if(jb->subscription & JABBER_SUB_FROM) {
 				if(jb->subscription & JABBER_SUB_TO)
 					sub = _("Both");
@@ -1209,6 +1212,21 @@
 			}
 			
 			purple_notify_user_info_add_pair(user_info, _("Subscription"), sub);
+			
+			status = purple_presence_get_active_status(purple_buddy_get_presence(b));
+			value = purple_status_get_attr_value(status, "mood");
+			if(value && purple_value_get_type(value) == PURPLE_TYPE_STRING) {
+				const char *mood = purple_value_get_string(value);
+				
+				value = purple_status_get_attr_value(status, "moodtext");
+				if(value && purple_value_get_type(value) == PURPLE_TYPE_STRING) {
+					char *moodplustext = g_strdup_printf("%s (%s)",mood,purple_value_get_string(value));
+					
+					purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext);
+					g_free(moodplustext);
+				} else
+					purple_notify_user_info_add_pair(user_info, _("Mood"), mood);
+			}
 		}
 
 		for(l=jb->resources; l; l = l->next) {
--- a/libpurple/protocols/jabber/message.c	Tue Jun 12 01:25:46 2007 +0000
+++ b/libpurple/protocols/jabber/message.c	Tue Jun 12 03:19:42 2007 +0000
@@ -357,7 +357,7 @@
 		} else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) {
 			xmlnode *items;
 			jm->type = JABBER_MESSAGE_EVENT;
-			for(items = child->child; items; items = items->next)
+			for(items = xmlnode_get_child(child,"items"); items; items = items->next)
 				jm->eventitems = g_list_append(jm->eventitems, items);
 		} else if(!strcmp(child->name, "error")) {
 			const char *code = xmlnode_get_attrib(child, "code");
--- a/libpurple/protocols/jabber/pep.c	Tue Jun 12 01:25:46 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Tue Jun 12 03:19:42 2007 +0000
@@ -49,9 +49,9 @@
 	
 	for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) {
 		xmlnode *items = (xmlnode*)itemslist->data;
-		const char *xmlns = xmlnode_get_namespace(items);
+		const char *nodename = xmlnode_get_attrib(items,"node");
 		
-		if((jph = g_hash_table_lookup(pep_handlers, xmlns)))
+		if(nodename && (jph = g_hash_table_lookup(pep_handlers, nodename)))
 			jph(jm->js, jid, items);
 	}
 	
--- a/libpurple/protocols/jabber/usermood.c	Tue Jun 12 01:25:46 2007 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Tue Jun 12 03:19:42 2007 +0000
@@ -23,6 +23,7 @@
 #include "pep.h"
 
 #include <string.h>
+#include "internal.h"
 
 static char *moodstrings[] = {
 	"unknown",
@@ -126,7 +127,7 @@
 		JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL);
 		const char *status_id = jabber_buddy_state_get_status_id(resource->state);
 		
-		purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", newmood, "moodtext", moodtext?moodtext:"", NULL);
+		purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", _(moodstrings[newmood]), "moodtext", moodtext?moodtext:"", NULL);
 	}
 	if (moodtext)
 		g_free(moodtext);