diff src/protocols/oscar/oscar.c @ 10567:54f7939df8e3

[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 <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 03 Feb 2005 15:37:13 +0000
parents 3b66a8f25bad
children 2b05acfeec65
line wrap: on
line diff
--- 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<br><b>%s</b>: %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<br>", _("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<br>", _("Member Since"), ctime(&t));
 	}