From: <ro...@us...> - 2006-07-26 04:05:18
|
Revision: 16577 Author: roast Date: 2006-07-25 20:32:31 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16577&view=rev Log Message: ----------- boolean for to choose to log original or corrected html Modified Paths: -------------- branches/soc-2006-file-loggers/src/log.c Modified: branches/soc-2006-file-loggers/src/log.c =================================================================== --- branches/soc-2006-file-loggers/src/log.c 2006-07-26 03:18:31 UTC (rev 16576) +++ branches/soc-2006-file-loggers/src/log.c 2006-07-26 03:32:31 UTC (rev 16577) @@ -565,6 +565,7 @@ gaim_prefs_add_bool("/core/logging/log_ims", FALSE); gaim_prefs_add_bool("/core/logging/log_chats", FALSE); gaim_prefs_add_bool("/core/logging/log_system", FALSE); + gaim_prefs_add_bool("/core/logging/log_corrected_html", TRUE); gaim_prefs_add_string("/core/logging/format", "txt"); @@ -1017,6 +1018,7 @@ GString *writebuf; GIOStatus iostat; GError *gerror = NULL; + gboolean log_corrected_html = gaim_prefs_get_bool("/core/logging/log_corrected_html"); char *from_normed = g_strdup(gaim_normalize(log->account, from)); char *from_attributes; @@ -1081,7 +1083,11 @@ if(!data->channel) return 0; - gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); + if (log_corrected_html) { + gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); + } else { + msg_fixed = (char *)message; + } if (log->type == GAIM_LOG_SYSTEM) { g_string_printf(writebuf, "\t<event time=\"%s\"%s gaim:type=\"system\">%s</event>\n", date, from_attributes, msg_fixed); @@ -1140,7 +1146,10 @@ else written += written_buf; g_free(date); - g_free(msg_fixed); + if (log_corrected_html) { + // free only if we need to free this + g_free(msg_fixed); + } // append suffix to file and seek back to keep a valid XML document out of the user space buffer g_string_printf(writebuf, @@ -1276,6 +1285,7 @@ GString *writebuf = g_string_new(""); GIOStatus iostat; GError *gerror = NULL; + gboolean log_corrected_html = gaim_prefs_get_bool("/core/logging/log_corrected_html"); if(!data) { const char *prpl = @@ -1321,7 +1331,12 @@ if(!data->channel) return 0; - gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); + if (log_corrected_html) { + gaim_markup_html_to_xhtml(message, &msg_fixed, NULL); + } else { + msg_fixed = (char *)message; + } + date = log_get_timestamp(log, time); if(log->type == GAIM_LOG_SYSTEM) @@ -1358,7 +1373,10 @@ date, from, msg_fixed); } g_free(date); - g_free(msg_fixed); + if (log_corrected_html) { + // free only if we need to free this + g_free(msg_fixed); + } iostat = g_io_channel_write_chars(data->channel, writebuf->str, -1, &written_buf, &gerror); if (iostat == G_IO_STATUS_ERROR) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |