diff src/connection.c @ 13507:702107dd58f1

[gaim-migrate @ 15883] I noticed that we were writing "FOO has signed off" noticed to the system log after we disconnected. With the HTML logger, this results in a new <html>...</html> block being added, with a duplicate header and everything. It seems we shouldn't be writing these messages after the system log has been closed. "Fixing" the HTML logger might be a good idea as well. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 14 Mar 2006 06:59:14 +0000
parents a88ca6da0b38
children 3ae8a3935406
line wrap: on
line diff
--- a/src/connection.c	Tue Mar 14 06:38:05 2006 +0000
+++ b/src/connection.c	Tue Mar 14 06:59:14 2006 +0000
@@ -262,9 +262,6 @@
 	}
 
 	if (gc->state == GAIM_CONNECTED) {
-#if 0
-		GList *wins;
-#endif
 		GaimAccount *account;
 		GaimPresence *presence;
 
@@ -276,14 +273,18 @@
 
 		if (gaim_prefs_get_bool("/core/logging/log_system"))
 		{
-			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),
-						   gaim_presence_get_login_time(presence),
-						   msg);
-			g_free(msg);
+			GaimLog *log = gaim_account_get_log(account, TRUE);
+
+			if (log != NULL)
+			{
+				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),
+							   gaim_presence_get_login_time(presence),
+							   msg);
+				g_free(msg);
+			}
 		}
 
 		if (ops != NULL && ops->connected != NULL)
@@ -291,19 +292,6 @@
 
 		gaim_blist_add_account(account);
 
-		/*
-		 * XXX This is a hack! Remove this and replace it with a better event
-		 *     notification system.
-		 */
-#if 0
-		/* This looks like it was horribly broken before I got here... */
-		/* Why is it updating the first tab of each window? */
-		for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
-			GaimConvWindow *win = (GaimConvWindow *)wins->data;
-			gaim_conversation_update(gaim_conv_window_get_conversation_at(win, 0),
-									 GAIM_CONV_ACCOUNT_ONLINE);
-		}
-#endif
 		gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc);
 
 		serv_set_permit_deny(gc);
@@ -318,13 +306,17 @@
 
 		if (gaim_prefs_get_bool("/core/logging/log_system"))
 		{
-			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);
+			GaimLog *log = gaim_account_get_log(account, FALSE);
+
+			if (log != NULL)
+			{
+				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);