diff src/status.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 c358be635301
children f5d4300aeed8
line wrap: on
line diff
--- a/src/status.c	Tue Mar 14 06:38:05 2006 +0000
+++ b/src/status.c	Tue Mar 14 06:59:14 2006 +0000
@@ -646,10 +646,14 @@
 
 		if (tmp != NULL)
 		{
-			GaimLog *log = gaim_account_get_log(buddy->account);
+			GaimLog *log = gaim_account_get_log(buddy->account, FALSE);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, buddy_alias,
-			               current_time, tmp);
+			if (log != NULL)
+			{
+				gaim_log_write(log, GAIM_MESSAGE_SYSTEM, buddy_alias,
+				               current_time, tmp);
+			}
+
 			g_free(tmp);
 		}
 	}
@@ -1318,26 +1322,34 @@
 	{
 		if (gaim_prefs_get_bool("/core/logging/log_system"))
 		{
-			GaimLog *log = gaim_account_get_log(buddy->account);
-			char *tmp = g_strdup_printf(_("%s became idle"),
-			gaim_buddy_get_alias(buddy));
+			GaimLog *log = gaim_account_get_log(buddy->account, FALSE);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
-			gaim_buddy_get_alias(buddy), current_time, tmp);
-			g_free(tmp);
+			if (log != NULL)
+			{
+				char *tmp = g_strdup_printf(_("%s became idle"),
+				gaim_buddy_get_alias(buddy));
+
+				gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
+				gaim_buddy_get_alias(buddy), current_time, tmp);
+				g_free(tmp);
+			}
 		}
 	}
 	else if (old_idle && !idle)
 	{
 		if (gaim_prefs_get_bool("/core/logging/log_system"))
 		{
-			GaimLog *log = gaim_account_get_log(buddy->account);
-			char *tmp = g_strdup_printf(_("%s became unidle"),
-			gaim_buddy_get_alias(buddy));
+			GaimLog *log = gaim_account_get_log(buddy->account, FALSE);
 
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
-			gaim_buddy_get_alias(buddy), current_time, tmp);
-			g_free(tmp);
+			if (log != NULL)
+			{
+				char *tmp = g_strdup_printf(_("%s became unidle"),
+				gaim_buddy_get_alias(buddy));
+
+				gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
+				gaim_buddy_get_alias(buddy), current_time, tmp);
+				g_free(tmp);
+			}
 		}
 	}
 
@@ -1390,17 +1402,21 @@
 
 		if (gaim_prefs_get_bool("/core/logging/log_system"))
 		{
-			GaimLog *log = gaim_account_get_log(account);
-			char *msg;
+			GaimLog *log = gaim_account_get_log(account, FALSE);
+
+			if (log != NULL)
+			{
+				char *msg;
 
-			if (idle)
-				msg = g_strdup_printf(_("+++ %s became idle"), gaim_account_get_username(account));
-			else
-				msg = g_strdup_printf(_("+++ %s became unidle"), gaim_account_get_username(account));
-			gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
-						   gaim_account_get_username(account),
-						   idle_time, msg);
-			g_free(msg);
+				if (idle)
+					msg = g_strdup_printf(_("+++ %s became idle"), gaim_account_get_username(account));
+				else
+					msg = g_strdup_printf(_("+++ %s became unidle"), gaim_account_get_username(account));
+				gaim_log_write(log, GAIM_MESSAGE_SYSTEM,
+							   gaim_account_get_username(account),
+							   idle_time, msg);
+				g_free(msg);
+			}
 		}
 
 		gc = gaim_account_get_connection(account);