changeset 8517:5cb93726e4d5

[gaim-migrate @ 9256] "The problem I noticed with the <AUTO RESPONSE> in plain text logging was that it was logged correctly as plain text but the log reading was not doing html escaping. I also noticed that because all sent text is now marked up in html, things like < > and & were logged as &lt; &gt and &amp; etc. This patch fixes the above problems by improving the markup stripping before writing the log and escaping html while reading the log (only affects plain text logging). I would have posted to sourceforge, but it seems to be having problems at the moment. If I get a chance I'll post it there too." --Stu Tomlinson Nathan, this should fixe the issues you were hitting committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 28 Mar 2004 19:53:43 +0000
parents 5b25f72c4723
children 833dd756dcc3
files src/log.c src/util.c
diffstat 2 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/log.c	Sun Mar 28 18:00:04 2004 +0000
+++ b/src/log.c	Sun Mar 28 19:53:43 2004 +0000
@@ -689,7 +689,7 @@
 
 static char *txt_logger_read(GaimLog *log, GaimLogReadFlags *flags)
 {
-	char *read, *minus_header;
+	char *read, *minus_header, *minus_header2;
 	struct generic_logger_data *data = log->logger_data;
 	*flags = 0;
 	if (!data || !data->path)
@@ -701,7 +701,9 @@
 		else
 			minus_header = g_strdup(minus_header + 1);
 		g_free(read);
-		return minus_header;
+		minus_header2 = gaim_escape_html(minus_header);
+		g_free(minus_header);
+		return minus_header2;
 	}
         return g_strdup(_("<font color=\"red\"><b>Could not read file: %s</b></font>"));
 }
--- a/src/util.c	Sun Mar 28 18:00:04 2004 +0000
+++ b/src/util.c	Sun Mar 28 19:53:43 2004 +0000
@@ -1042,6 +1042,13 @@
 	{
 		if (str2[i] == '<')
 		{
+			if (strncasecmp(str2 + i, "<br>", 4) == 0)
+			{
+				str2[j++] = '\n';
+				i = i + 3;
+				continue;
+			}
+
 			k = i + 1;
 
 			if(g_ascii_isspace(str2[k]))
@@ -1079,6 +1086,27 @@
 		    continue;
 		}
 
+		if (str2[i] == '&' && strncasecmp(str2 + i, "&amp;", 5) == 0)
+		{
+			str2[j++] = '&';
+			i = i + 4;
+			continue;
+		}
+
+		if (str2[i] == '&' && strncasecmp(str2 + i, "&lt;", 4) == 0)
+		{
+			str2[j++] = '<';
+			i = i + 3;
+			continue;
+		}
+
+		if (str2[i] == '&' && strncasecmp(str2 + i, "&gt;", 4) == 0)
+		{
+			str2[j++] = '>';
+			i = i + 3;
+			continue;
+		}
+
 		if (visible)
 			str2[j++] = str2[i];
 	}