[gaim-migrate @ 12895]

Wed, 22 Jun 2005 23:23:14 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Wed, 22 Jun 2005 23:23:14 +0000
changeset 11023
1e39a0e74a18
parent 11022
0e1fb0cddeee
child 11024
f4e005b0922b

[gaim-migrate @ 12895]
sf patch #1223459, from Richard Laager
Fix "last seen" in CVS HEAD

committer: Mark Doliner <markdoliner@pidgin.im>

src/gtkblist.c file | annotate | diff | comparison | revisions
--- a/src/gtkblist.c	Wed Jun 22 23:10:58 2005 +0000
+++ b/src/gtkblist.c	Wed Jun 22 23:23:14 2005 +0000
@@ -2760,7 +2760,6 @@
 		char *tmp;
 		gboolean idle;
 		time_t idle_secs, signon;
-		int lastseen;
 		unsigned int warning_level;
 
 		if (GAIM_BLIST_NODE_IS_CONTACT(node))
@@ -2841,10 +2840,32 @@
 		}
 
 		/* Last Seen */
-		if ((b->present == GAIM_BUDDY_SIGNING_ON) ||
-			(b->present == GAIM_BUDDY_OFFLINE))
+		if (!GAIM_BUDDY_IS_ONLINE(b))
 		{
-			lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
+			struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data;
+			GaimBlistNode *bnode;
+			int lastseen = 0;
+
+			if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node))
+			{
+				/* We're either looking at buddy for a collapsed contact or
+				 * a contact (which is expanded) so we show the most recent
+				 * (largest) last_seen time for any of the buddies under
+				 * the contact. */
+				for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
+				{
+					int value = gaim_blist_node_get_int(bnode, "last_seen");
+					if (value > lastseen)
+						lastseen = value;
+				}
+			}
+			else
+			{
+				/* We're dealing with a buddy under an expanded contact,
+				 * so we show the last_seen time for the buddy. */
+				lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
+			}
+
 			if (lastseen > 0)
 			{
 				tmp = gaim_str_seconds_to_string(time(NULL) - lastseen);

mercurial