changeset 23253:4f49d4b25e24

If the status name and status message are the same for a jabber buddy, don't duplicate the information when displaying the Get Info window. (e.g. "Status: Away: Away")
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 30 May 2008 14:40:10 +0000
parents 996c80ab3dbc
children a67467e5a586
files libpurple/protocols/jabber/buddy.c
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Fri May 30 04:33:44 2008 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Fri May 30 14:40:10 2008 +0000
@@ -824,10 +824,14 @@
 		}		
 		if(jbr) {
 			char *purdy = NULL;
+			char *status_name = jabber_buddy_state_get_name(jbr->state);
 			if(jbr->status)
 				purdy = purple_strdup_withhtml(jbr->status);
-			tmp = g_strdup_printf("%s%s%s", jabber_buddy_state_get_name(jbr->state),
-							(purdy ? ": " : ""),
+			if(status_name && purdy && !strcmp(status_name, purdy))
+				status_name = NULL;
+
+			tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""),
+							((status_name && purdy) ? ": " : ""),
 							(purdy ? purdy : ""));
 			purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp);
 			g_free(tmp);
@@ -963,7 +967,8 @@
 		gboolean multiple_resources = jbi->jb->resources && (g_list_length(jbi->jb->resources) > 1);
 
 		for(resources = jbi->jb->resources; resources; resources = resources->next) {
-			char *purdy = NULL;
+			char *purdy = NULL, *status_name = NULL;
+			
 			jbr = resources->data;
 
 			if(jbr->client.name) {
@@ -987,10 +992,14 @@
 				}
 			}
 
+			status_name = jabber_buddy_state_get_name(jbr->state);
 			if(jbr->status)
 				purdy = purple_strdup_withhtml(jbr->status);
-			tmp = g_strdup_printf("%s%s%s", jabber_buddy_state_get_name(jbr->state),
-								  (purdy ? ": " : ""),
+			if(status_name && purdy && !strcmp(status_name, purdy))
+				status_name = NULL;
+			
+			tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""),
+								  ((status_name && purdy) ? ": " : ""),
 								  (purdy ? purdy : ""));
 			purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp);
 			g_free(tmp);