# HG changeset patch # User Stu Tomlinson # Date 1107445033 0 # Node ID 54f7939df8e3b909941bbafc1f82e73a731bb0a0 # Parent 62fc579810f4aa190a2a93ac19c5a23d544ebda7 [gaim-migrate @ 11951] 1) fix the Logged in: thing in tooltips because it disappeared in the status re-write 2) fix the logged in 49 thousand odd days here too committer: Tailor Script diff -r 62fc579810f4 -r 54f7939df8e3 src/blist.c --- a/src/blist.c Wed Feb 02 17:13:41 2005 +0000 +++ b/src/blist.c Thu Feb 03 15:37:13 2005 +0000 @@ -801,21 +801,6 @@ ops->update(gaimbuddylist, (GaimBlistNode *)buddy); } -void gaim_blist_update_buddy_signon(GaimBuddy *buddy, time_t signon) -{ - GaimBlistUiOps *ops = gaimbuddylist->ui_ops; - - g_return_if_fail(buddy != NULL); - - if (buddy->signon == signon) - return; - - buddy->signon = signon; - - if (ops && ops->update) - ops->update(gaimbuddylist, (GaimBlistNode *)buddy); -} - void gaim_blist_update_buddy_icon(GaimBuddy *buddy) { GaimBlistUiOps *ops = gaimbuddylist->ui_ops; diff -r 62fc579810f4 -r 54f7939df8e3 src/blist.h --- a/src/blist.h Wed Feb 02 17:13:41 2005 +0000 +++ b/src/blist.h Thu Feb 03 15:37:13 2005 +0000 @@ -113,7 +113,6 @@ char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */ GaimBuddyPresenceState present; /**< This is 0 if the buddy appears offline, 1 if he appears online, and 2 if he has recently signed on */ - time_t signon; /**< The time the buddy signed on. */ int uc; /**< This is a cryptic bitmask that makes sense only to the prpl. This will get changed */ void *proto_data; /**< This allows the prpl to associate whatever data it wants with a buddy */ GaimBuddyIcon *icon; /**< The buddy icon. */ @@ -260,14 +259,6 @@ void gaim_blist_update_buddy_status(GaimBuddy *buddy, GaimStatus *old_status); /** - * Updates a buddy's signon time. - * - * @param buddy The buddy whose sign-on time has changed. - * @param signon The buddy's signon time since the dawn of the UNIX epoch. - */ -void gaim_blist_update_buddy_signon(GaimBuddy *buddy, time_t signon); - -/** * Updates a buddy's icon. * * @param buddy The buddy whose buddy icon has changed diff -r 62fc579810f4 -r 54f7939df8e3 src/gtkblist.c --- a/src/gtkblist.c Wed Feb 02 17:13:41 2005 +0000 +++ b/src/gtkblist.c Thu Feb 03 15:37:13 2005 +0000 @@ -2668,7 +2668,7 @@ GaimPresence *presence; char *tmp; gboolean idle; - time_t idle_secs; + time_t idle_secs, signon; int lastseen; unsigned int warning_level; @@ -2728,9 +2728,10 @@ } /* Logged In */ - if (b->signon > 0) + signon = gaim_presence_get_login_time(presence); + if (signon > 0) { - tmp = gaim_str_seconds_to_string(time(NULL) - b->signon); + tmp = gaim_str_seconds_to_string(time(NULL) - signon); g_string_append_printf(str, _("\nLogged In: %s"), tmp); g_free(tmp); } diff -r 62fc579810f4 -r 54f7939df8e3 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Wed Feb 02 17:13:41 2005 +0000 +++ b/src/protocols/oscar/oscar.c Thu Feb 03 15:37:13 2005 +0000 @@ -109,6 +109,7 @@ guint icontimer; guint getblisttimer; guint getinfotimer; + gint timeoffset; struct { guint maxwatchers; /* max users who can watch you */ @@ -3020,8 +3021,10 @@ else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) signon = time(NULL) - info->sessionlen; - if (!aim_sncmp(gaim_account_get_username(account), info->sn)) + if (!aim_sncmp(gaim_account_get_username(account), info->sn)) { gaim_connection_set_display_name(gc, info->sn); + od->timeoffset = signon - gc->login_time; + } bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, info->sn)); if (!bi) { @@ -3095,7 +3098,7 @@ gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_AWAY, NULL); else gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_AVAILABLE, NULL); - gaim_prpl_got_user_login_time(account, info->sn, signon); + gaim_prpl_got_user_login_time(account, info->sn, signon - od->timeoffset); gaim_prpl_got_user_warning_level(account, info->sn, info->warnlevel/10.0 + 0.5); if (time_idle > 0) @@ -4279,6 +4282,7 @@ static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { GaimConnection *gc = sess->aux_data; GaimAccount *account = gaim_connection_get_account(gc); + OscarData *od = gc->proto_data; GString *str; gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL, *title = NULL; va_list ap; @@ -4293,12 +4297,12 @@ g_string_append_printf(str, "\n
%s: %d%%", _("Warning Level"), (int)((userinfo->warnlevel/10.0) + 0.5)); if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) { - time_t t = userinfo->onlinesince; + time_t t = userinfo->onlinesince - od->timeoffset; oscar_string_append(str, "\n
", _("Online Since"), ctime(&t)); } if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { - time_t t = userinfo->membersince; + time_t t = userinfo->membersince - od->timeoffset; oscar_string_append(str, "\n
", _("Member Since"), ctime(&t)); } diff -r 62fc579810f4 -r 54f7939df8e3 src/status.c --- a/src/status.c Wed Feb 02 17:13:41 2005 +0000 +++ b/src/status.c Thu Feb 03 15:37:13 2005 +0000 @@ -1589,6 +1589,14 @@ return presence->warning_level; } +time_t +gaim_presence_get_login_time(const GaimPresence *presence) +{ + g_return_val_if_fail(presence != NULL, 0); + + return presence->login_time; +} + gint gaim_presence_compare(const GaimPresence *presence1, const GaimPresence *presence2) diff -r 62fc579810f4 -r 54f7939df8e3 src/status.h --- a/src/status.h Wed Feb 02 17:13:41 2005 +0000 +++ b/src/status.h Thu Feb 03 15:37:13 2005 +0000 @@ -916,6 +916,15 @@ unsigned int gaim_presence_get_warning_level(const GaimPresence *presence); /** + * Returns the presence's login time. + * + * @param presence The presence. + * + * @return The presence's login time. + */ +time_t gaim_presence_get_login_time(const GaimPresence *presence); + +/** * Compares two presences for availability. * * @param presence1 The first presence.