From: <sa...@us...> - 2006-09-03 08:01:18
|
Revision: 17137 http://svn.sourceforge.net/gaim/?rev=17137&view=rev Author: sadrul Date: 2006-09-03 01:01:12 -0700 (Sun, 03 Sep 2006) Log Message: ----------- Patch from wabz (Richard Nelson) to show 'Last Seen' for offline buddies. I have also added a fix to show offline buddies in the tooltip for a contact if 'show offline buddies' is turned on. Modified Paths: -------------- trunk/console/gntblist.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-09-03 07:40:11 UTC (rev 17136) +++ trunk/console/gntblist.c 2006-09-03 08:01:12 UTC (rev 17137) @@ -1045,6 +1045,7 @@ GntTree *tree; GntWidget *widget, *box; char *title = NULL; + int lastseen = 0; widget = ggblist->tree; tree = GNT_TREE(widget); @@ -1070,11 +1071,21 @@ if (GAIM_BLIST_NODE_IS_CONTACT(node)) { GaimBuddy *pr = gaim_contact_get_priority_buddy((GaimContact*)node); + gboolean offline = !GAIM_BUDDY_IS_ONLINE(pr); + gboolean showoffline = gaim_prefs_get_bool(PREF_ROOT "/showoffline"); + title = g_strdup(gaim_contact_get_alias((GaimContact*)node)); tooltip_for_buddy(pr, str); for (node = node->child; node; node = node->next) { - if (node == (GaimBlistNode*)pr || !GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node)) + if (offline) { + int value = gaim_blist_node_get_int(node, "last_seen"); + if (value > lastseen) + lastseen = value; + } + if (node == (GaimBlistNode*)pr) continue; + if (!showoffline && !GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node)) + continue; str = g_string_append(str, "\n----------\n"); g_string_append_printf(str, _("Nickname: %s\n"), gaim_buddy_get_name((GaimBuddy*)node)); tooltip_for_buddy((GaimBuddy*)node, str); @@ -1083,6 +1094,8 @@ GaimBuddy *buddy = (GaimBuddy *)node; tooltip_for_buddy(buddy, str); title = g_strdup(gaim_buddy_get_name(buddy)); + if (!GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node)) + lastseen = gaim_blist_node_get_int(node, "last_seen"); } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { GaimGroup *group = (GaimGroup *)node; @@ -1105,6 +1118,12 @@ return; } + if (lastseen > 0) { + char *tmp = gaim_str_seconds_to_string(time(NULL) - lastseen); + g_string_append_printf(str, _("\nLast Seen: %s ago"), tmp); + g_free(tmp); + } + gnt_widget_get_position(widget, &x, &y); gnt_widget_get_size(widget, &width, NULL); top = gnt_tree_get_selection_visible_line(tree); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |