changeset 26691:803e05b3a871

Retrieve status message to display in Buddy List from PurplePresence. JabberBuddyResources are not tracked when they go offline, so this would return NULL if all resources are offline. In either case, the function returned the status message from the highest priority resource, which is also the one in the PurplePresence. Closes #1420.
author Paul Aurich <paul@darkrain42.org>
date Sun, 26 Apr 2009 03:18:07 +0000
parents 0054bf136314
children 81559f83e993
files libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/buddy.h libpurple/protocols/jabber/jabber.c
diffstat 3 files changed, 3 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Sun Apr 26 02:27:08 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Sun Apr 26 03:18:07 2009 +0000
@@ -202,21 +202,6 @@
 	jabber_buddy_resource_free(jbr);
 }
 
-const char *jabber_buddy_get_status_msg(JabberBuddy *jb)
-{
-	JabberBuddyResource *jbr;
-
-	if(!jb)
-		return NULL;
-
-	jbr = jabber_buddy_find_resource(jb, NULL);
-
-	if(!jbr)
-		return NULL;
-
-	return jbr->status;
-}
-
 /*******
  * This is the old vCard stuff taken from the old prpl.  vCards, by definition
  * are a temporary thing until jabber can get its act together and come up
--- a/libpurple/protocols/jabber/buddy.h	Sun Apr 26 02:27:08 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.h	Sun Apr 26 03:18:07 2009 +0000
@@ -96,7 +96,6 @@
 		int priority, JabberBuddyState state, const char *status);
 void jabber_buddy_resource_free(JabberBuddyResource *jbr);
 void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource);
-const char *jabber_buddy_get_status_msg(JabberBuddy *jb);
 void jabber_buddy_get_info(PurpleConnection *gc, const char *who);
 
 GList *jabber_blist_node_menu(PurpleBlistNode *node);
--- a/libpurple/protocols/jabber/jabber.c	Sun Apr 26 02:27:08 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Apr 26 03:18:07 2009 +0000
@@ -1701,10 +1701,11 @@
 	} else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) {
 		ret = g_strdup(jb->error_msg);
 	} else {
+		PurplePresence *presence = purple_buddy_get_presence(b);
+		PurpleStatus *status =purple_presence_get_active_status(presence);
 		char *stripped;
 
-		if(!(stripped = purple_markup_strip_html(jabber_buddy_get_status_msg(jb)))) {
-			PurplePresence *presence = purple_buddy_get_presence(b);
+		if(!(stripped = purple_markup_strip_html(purple_status_get_attr_string(status, "message")))) {
 			if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) {
 				PurpleStatus *status = purple_presence_get_status(presence, "tune");
 				stripped = g_strdup(purple_status_get_attr_string(status, PURPLE_TUNE_TITLE));