cpw.malu.xmpp.idle: be2cd9a5: Only show idle time for idle resources i...

malu at pidgin.im malu at pidgin.im
Tue Feb 3 15:25:33 EST 2009


-----------------------------------------------------------------
Revision: be2cd9a5fc757e3ed024c6c2df60547fc162587e
Ancestor: 9dfa59217f19d3a885590a66ec6faca4e8b568a2
Author: malu at pidgin.im
Date: 2009-02-03T20:13:02
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/be2cd9a5fc757e3ed024c6c2df60547fc162587e

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

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	04ccb02370081bef6aad48cad7df6d7a100dedd1
+++ libpurple/protocols/jabber/jabber.c	ff5161f37e32be9903271bd6392a03b47ac61698
@@ -1686,7 +1686,7 @@ void jabber_tooltip_text(PurpleBuddy *b,
 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 @@ void jabber_tooltip_text(PurpleBuddy *b,
 		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 @@ void jabber_tooltip_text(PurpleBuddy *b,
 					g_free(playing);
 				}
 			}
-		}
-
+		}	
+		
 		for(l=jb->resources; l; l = l->next) {
 			char *text = NULL;
 			char *res = NULL;
@@ -1788,7 +1790,10 @@ void jabber_tooltip_text(PurpleBuddy *b,
 			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",


More information about the Commits mailing list