changeset 11973:0fab529c01fc

[gaim-migrate @ 14266] Get rid of gc->login_time FYI login_time and is_idle are both in gc->presence committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 04 Nov 2005 17:47:04 +0000
parents 73777ad45562
children 2ff2965895f3
files src/account.c src/connection.c src/connection.h src/protocols/oscar/oscar.c src/status.c
diffstat 5 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Fri Nov 04 17:33:32 2005 +0000
+++ b/src/account.c	Fri Nov 04 17:47:04 2005 +0000
@@ -1891,13 +1891,15 @@
 	g_return_val_if_fail(account != NULL, NULL);
 
 	if(!account->system_log){
-		GaimConnection *gc;
-
-		gc = gaim_account_get_connection(account);
+		GaimPresence *presence;
+		int login_time;
+
+		presence = gaim_account_get_presence(account);
+		login_time = gaim_presence_get_login_time(presence);
 
 		account->system_log	 = gaim_log_new(GAIM_LOG_SYSTEM,
 				gaim_account_get_username(account), account, NULL,
-				(gc != NULL && gc->login_time != 0) ? gc->login_time : time(NULL));
+				(login_time != 0) ? login_time : time(NULL));
 	}
 
 	return account->system_log;
--- a/src/connection.c	Fri Nov 04 17:33:32 2005 +0000
+++ b/src/connection.c	Fri Nov 04 17:47:04 2005 +0000
@@ -274,7 +274,7 @@
 		presence = gaim_account_get_presence(account);
 
 		/* Set the time the account came online */
-		time(&gc->login_time);
+		gaim_presence_set_login_time(presence, time(NULL));
 
 		if (gaim_prefs_get_bool("/core/logging/log_system"))
 		{
@@ -282,7 +282,8 @@
 			char *msg = g_strdup_printf("+++ %s signed on",
 										gaim_account_get_username(account));
 			gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
-						   gaim_account_get_username(account), gc->login_time,
+						   gaim_account_get_username(account),
+						   gaim_presence_get_login_time(presence),
 						   msg);
 			g_free(msg);
 		}
--- a/src/connection.h	Fri Nov 04 17:33:32 2005 +0000
+++ b/src/connection.h	Fri Nov 04 17:47:04 2005 +0000
@@ -89,7 +89,6 @@
 	guint keepalive;             /**< Keep-alive.                        */
 
 	guint idle_timer;            /**< The idle timer.                    */
-	time_t login_time;           /**< Time of login.                     */
 	time_t last_sent_time;       /**< The time something was last sent.  */
 
 	gboolean is_auto_away;       /**< Whether or not it's auto-away.     */
--- a/src/protocols/oscar/oscar.c	Fri Nov 04 17:33:32 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Nov 04 17:47:04 2005 +0000
@@ -3468,6 +3468,7 @@
 {
 	GaimConnection *gc;
 	GaimAccount *account;
+	GaimPresence *presence;
 	OscarData *od;
 	struct buddyinfo *bi;
 	time_t time_idle = 0, signon = 0;
@@ -3480,12 +3481,13 @@
 
 	gc = sess->aux_data;
 	account = gaim_connection_get_account(gc);
+	presence = gaim_account_get_presence(account);
 	od = gc->proto_data;
 
 	va_start(ap, fr);
 	info = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
-	
+
 	g_return_val_if_fail(info != NULL, 1);
 	g_return_val_if_fail(info->sn != NULL, 1);
 
@@ -3518,7 +3520,7 @@
 
 	if (!aim_sncmp(gaim_account_get_username(account), info->sn)) {
 		gaim_connection_set_display_name(gc, info->sn);
-		od->timeoffset = signon - gc->login_time;
+		od->timeoffset = signon - gaim_presence_get_login_time(presence);
 	}
 
 	bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, info->sn));
--- a/src/status.c	Fri Nov 04 17:33:32 2005 +0000
+++ b/src/status.c	Fri Nov 04 17:47:04 2005 +0000
@@ -1529,7 +1529,7 @@
 {
 	g_return_val_if_fail(presence != NULL, 0);
 
-	return presence->login_time;
+	return gaim_presence_is_online(presence) ? presence->login_time : 0;
 }
 
 gint