diff src/connection.c @ 8573:7dcd6f26e4a7

[gaim-migrate @ 9321] " This patch reimplements the system log. It writes system log to ~/.gaim/logs/<protocol>/<username>/.system/<timestamp>.(txt|html), where <timestamp> is the time that the account <username> with <protocol> signs on. Nathan (faceprint) and LSchiere suggested this logging scheme. No code is currently written to read the old system logs. Note that if you change the logging format, you need to re-login the accounts for the change to take effect." --Ka-Hing (javabsp) Cheung who continues: "Now this one applies, also contains a rider patch that, if you enable sound for "Someone says your name in chat", it will not play a sound if the message is a system message, like if jabber chat tells you that "*** becomes available" and *** is you, it won't play a sound." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 03 Apr 2004 18:34:29 +0000
parents ef881489396e
children 725413cc9fb9
line wrap: on
line diff
--- a/src/connection.c	Sat Apr 03 18:01:58 2004 +0000
+++ b/src/connection.c	Sat Apr 03 18:34:29 2004 +0000
@@ -313,6 +313,7 @@
 		GaimBlistNode *gnode,*cnode,*bnode;
 		GList *wins;
 		GList *add_buds=NULL;
+		GaimAccount *account = gaim_connection_get_account(gc);
 
 		/* Set the time the account came online */
 		time(&gc->login_time);
@@ -321,7 +322,7 @@
 			ops->connected(gc);
 
 		gaim_blist_show();
-		gaim_blist_add_account(gc->account);
+		gaim_blist_add_account(account);
 
 		/*
 		 * XXX This is a hack! Remove this and replace it with a better event
@@ -335,6 +336,17 @@
 
 		/* LOG system_log(log_signon, gc, NULL,
 		   OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); */
+		if(gaim_prefs_get_bool("/core/logging/log_system") &&
+		   gaim_prefs_get_bool("/core/logging/log_own_states")){
+			GaimLog *log = gaim_account_get_log(account);
+			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,
+						   msg);
+			g_free(msg);						   
+		}
+
 		gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc);
 
 #if 0
@@ -380,8 +392,23 @@
 		serv_set_permit_deny(gc);
 	}
 	else if (gc->state == GAIM_DISCONNECTED) {
+		GaimAccount *account = gaim_connection_get_account(gc);
+
+		if(gaim_prefs_get_bool("/core/logging/log_system") &&
+		   gaim_prefs_get_bool("/core/logging/log_own_states")){
+			GaimLog *log = gaim_account_get_log(account);
+			char *msg = g_strdup_printf("+++ %s signed off",
+										gaim_account_get_username(account));
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
+						   gaim_account_get_username(account), time(NULL),
+						   msg);
+			g_free(msg);						   
+		}
+
+		gaim_account_destroy_log(account);
+
 		if (ops != NULL && ops->disconnected != NULL)
-			ops->disconnected(gc);
+			ops->disconnected(gc);		
 	}
 }