changeset 25691:65f2c84f122f

Only show idle time for idle resources in tooltip text when there is more than one resource online for a buddy. Since if there is only one resource online, and it is idle, this idle time will be shown as the "over all" idle time for the buddy. This avoid showing redundant information.
author Marcus Lundblad <ml@update.uu.se>
date Tue, 03 Feb 2009 20:13:02 +0000
parents c5d2559d6e0d
children a8224eb86581 ebd63c4f9405
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Feb 01 19:43:13 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Feb 03 20:13:02 2009 +0000
@@ -1686,7 +1686,7 @@
 void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
 {
 	JabberBuddy *jb;
-
+	
 	g_return_if_fail(b != NULL);
 	g_return_if_fail(b->account != NULL);
 	g_return_if_fail(b->account->gc != NULL);
@@ -1701,6 +1701,8 @@
 		const char *sub;
 		GList *l;
 		const char *mood;
+		gboolean multiple_resources = 
+			jb->resources && g_list_next(jb->resources);
 
 		if (full) {
 			PurpleStatus *status;
@@ -1747,8 +1749,8 @@
 					g_free(playing);
 				}
 			}
-		}
-
+		}	
+		
 		for(l=jb->resources; l; l = l->next) {
 			char *text = NULL;
 			char *res = NULL;
@@ -1788,7 +1790,10 @@
 			g_free(text);
 			
 			/* if the resource is idle, show that */
-			if (jbr->idle) {
+			/* only show it if there is more than one resource available for
+			 the buddy, since the "general" idleness will be shown anyway,
+			 this way we can see see the idleness of lower-priority resources */
+			if (jbr->idle && multiple_resources) {
 				gchar *idle_str = 
 					purple_str_seconds_to_string(time(NULL) - jbr->idle);
 				label = g_strdup_printf("%s%s",