diff src/log.c @ 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 53e38b1ce00a
children e293d0c42ccb
line wrap: on
line diff
--- 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 ||