changeset 7623:5381f96fc185

[gaim-migrate @ 8247] more logging tweaks. this should let the last </body></html> get written to all the open logs when you quit gaim. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 24 Nov 2003 07:00:39 +0000
parents 072feee65244
children 8df31c1aca4a
files src/conversation.c src/log.c
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Mon Nov 24 06:50:20 2003 +0000
+++ b/src/conversation.c	Mon Nov 24 07:00:39 2003 +0000
@@ -2755,5 +2755,7 @@
 void
 gaim_conversations_uninit(void)
 {
+	/* close the conversations, which will also finalize the logs for us */
+	gaim_conversation_foreach(gaim_conversation_destroy);
 	gaim_signals_unregister_by_instance(gaim_conversations_get_handle());
 }
--- a/src/log.c	Mon Nov 24 06:50:20 2003 +0000
+++ b/src/log.c	Mon Nov 24 07:00:39 2003 +0000
@@ -454,7 +454,8 @@
 
 		data->file = fopen(filename, "a");
 		if (!data->file) {
-			gaim_debug(GAIM_DEBUG_ERROR, "log", "Could not create log file %s\n", filename);
+			gaim_debug(GAIM_DEBUG_ERROR, "log",
+					"Could not create log file %s\n", filename);
 			g_free(filename);
 			return;
 		}
@@ -468,6 +469,11 @@
 			"<h3>Conversation with %s at %s on %s (%s)</h3>\n",
 			log->name, date, gaim_account_get_username(log->account), prpl);
 	}
+
+	/* if we can't write to the file, give up before we hurt ourselves */
+	if(!data->file)
+		return;
+
 	strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
 	if (type & GAIM_MESSAGE_SYSTEM)
 		fprintf(data->file, "(%s)<b> %s</b><br/>\n", date, message);
@@ -603,6 +609,10 @@
 			log->name, date, gaim_account_get_username(log->account), prpl);
 	}
 
+	/* if we can't write to the file, give up before we hurt ourselves */
+	if(!data->file)
+		return;
+
 	strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
 	stripped = gaim_markup_strip_html(message);
 	if (type & GAIM_MESSAGE_SEND ||