changeset 7489:8f05bdc08faf

[gaim-migrate @ 8102] This will produce better logs. I'm going to try to get even *better* logs committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 13 Nov 2003 00:48:05 +0000
parents c42d1532faab
children 1de432be83c5
files src/log.c
diffstat 1 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/log.c	Wed Nov 12 23:42:43 2003 +0000
+++ b/src/log.c	Thu Nov 13 00:48:05 2003 +0000
@@ -382,6 +382,7 @@
 static void html_logger_write(GaimLog *log, GaimMessageFlags type,
 		const char *from, time_t time, const char *message)
 {
+	GaimConnection *gc = gaim_account_get_connection(log->account);
 	char date[64];
 	if(!log->logger_data) {
 		/* This log is new */
@@ -436,7 +437,22 @@
 			log->name, date, gaim_account_get_username(log->account), prpl);
 	}
 	strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
-	fprintf(log->logger_data, "(%s) %s%s %s<br/>\n", date, from ? from : "", from ? ":" : "", message);
+	if (type & GAIM_MESSAGE_SYSTEM)
+		fprintf(log->logger_data, "(%s)<b> %s</b><br/>\n", date, message);
+	else if (type & GAIM_MESSAGE_WHISPER)
+		fprintf(log->logger_data, "<font color=\"#6C2585\">(%s)<b> %s:</b></font> %s<br/>\n",
+			date, from, message);
+	else if (type & GAIM_MESSAGE_AUTO_RESP) {
+		if (type & GAIM_MESSAGE_SEND)
+			fprintf(log->logger_data, _("<font color=\"#16569E\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, message);
+		else if (type & GAIM_MESSAGE_RECV)
+			fprintf(log->logger_data, _("<font color=\"#A82F2F\">(%s) <b>%s <AUTO-REPLY>:</b></font> %s<br/>\n"), date, from, message);
+	} else if (type & GAIM_MESSAGE_RECV)
+		fprintf(log->logger_data, "<font color=\"#A82F2F\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", 
+			date, from, gc->prpl->info->name, message);
+	else if (type & GAIM_MESSAGE_RECV)
+		fprintf(log->logger_data, "<font color=\"#16569E\">(%s) <b>%s:</b></font> <font sml=\"%s\">%s</font><br/>\n", 
+			date, from, gc->prpl->info->name, message);
 	fflush(log->logger_data);
 }
 
@@ -546,7 +562,22 @@
 
 	strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
 	stripped = gaim_markup_strip_html(message);
-	fprintf(log->logger_data, "(%s) %s%s %s\n", date, from ? from : "", from ? ":" : "", stripped);
+	if (type & GAIM_MESSAGE_SEND ||
+	    type & GAIM_MESSAGE_RECV)
+		fprintf(log->logger_data, "(%s) %s: %s\n", date, from, stripped);	
+	else if (type & GAIM_MESSAGE_SYSTEM)
+		fprintf(log->logger_data, "(%s) %s\n", date, stripped);
+	else if (type & GAIM_MESSAGE_AUTO_RESP)
+		fprintf(log->logger_data, _("(%s) %s <AUTO-REPLY>: %s\n"), date, from, stripped);
+	else if (type & GAIM_MESSAGE_NO_LOG) {
+		/* This shouldn't happen */
+		g_free(stripped);
+		return;
+	} else if (type & GAIM_MESSAGE_WHISPER)
+		fprintf(log->logger_data, "(%s) *%s* %s", date, from, stripped);
+	else
+		fprintf(log->logger_data, "(%s) %s%s %s\n", date, from ? from : "", from ? ":" : "", stripped);
+
 	fflush(log->logger_data);
 	g_free(stripped);
 }