Mercurial > pidgin
comparison src/gtkblist.c @ 11023:9a99b0815459
[gaim-migrate @ 12895]
sf patch #1223459, from Richard Laager
Fix "last seen" in CVS HEAD
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 22 Jun 2005 23:23:14 +0000 |
parents | 04f280376f06 |
children | 8d2007d738d5 |
comparison
equal
deleted
inserted
replaced
11022:4febc4df0eb8 | 11023:9a99b0815459 |
---|---|
2758 GaimBuddy *b; | 2758 GaimBuddy *b; |
2759 GaimPresence *presence; | 2759 GaimPresence *presence; |
2760 char *tmp; | 2760 char *tmp; |
2761 gboolean idle; | 2761 gboolean idle; |
2762 time_t idle_secs, signon; | 2762 time_t idle_secs, signon; |
2763 int lastseen; | |
2764 unsigned int warning_level; | 2763 unsigned int warning_level; |
2765 | 2764 |
2766 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | 2765 if (GAIM_BLIST_NODE_IS_CONTACT(node)) |
2767 { | 2766 { |
2768 c = (GaimContact *)node; | 2767 c = (GaimContact *)node; |
2839 g_free(tmp); | 2838 g_free(tmp); |
2840 } | 2839 } |
2841 } | 2840 } |
2842 | 2841 |
2843 /* Last Seen */ | 2842 /* Last Seen */ |
2844 if ((b->present == GAIM_BUDDY_SIGNING_ON) || | 2843 if (!GAIM_BUDDY_IS_ONLINE(b)) |
2845 (b->present == GAIM_BUDDY_OFFLINE)) | |
2846 { | 2844 { |
2847 lastseen = gaim_blist_node_get_int(&b->node, "last_seen"); | 2845 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data; |
2846 GaimBlistNode *bnode; | |
2847 int lastseen = 0; | |
2848 | |
2849 if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node)) | |
2850 { | |
2851 /* We're either looking at buddy for a collapsed contact or | |
2852 * a contact (which is expanded) so we show the most recent | |
2853 * (largest) last_seen time for any of the buddies under | |
2854 * the contact. */ | |
2855 for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next) | |
2856 { | |
2857 int value = gaim_blist_node_get_int(bnode, "last_seen"); | |
2858 if (value > lastseen) | |
2859 lastseen = value; | |
2860 } | |
2861 } | |
2862 else | |
2863 { | |
2864 /* We're dealing with a buddy under an expanded contact, | |
2865 * so we show the last_seen time for the buddy. */ | |
2866 lastseen = gaim_blist_node_get_int(&b->node, "last_seen"); | |
2867 } | |
2868 | |
2848 if (lastseen > 0) | 2869 if (lastseen > 0) |
2849 { | 2870 { |
2850 tmp = gaim_str_seconds_to_string(time(NULL) - lastseen); | 2871 tmp = gaim_str_seconds_to_string(time(NULL) - lastseen); |
2851 g_string_append_printf(str, _("\n<b>Last Seen:</b> %s ago"), tmp); | 2872 g_string_append_printf(str, _("\n<b>Last Seen:</b> %s ago"), tmp); |
2852 g_free(tmp); | 2873 g_free(tmp); |