comparison src/util.c @ 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 29aa90459620
children 389e2b9dae6a
comparison
equal deleted inserted replaced
8516:5b25f72c4723 8517:5cb93726e4d5
1040 1040
1041 for (i = 0, j = 0; str2[i]; i++) 1041 for (i = 0, j = 0; str2[i]; i++)
1042 { 1042 {
1043 if (str2[i] == '<') 1043 if (str2[i] == '<')
1044 { 1044 {
1045 if (strncasecmp(str2 + i, "<br>", 4) == 0)
1046 {
1047 str2[j++] = '\n';
1048 i = i + 3;
1049 continue;
1050 }
1051
1045 k = i + 1; 1052 k = i + 1;
1046 1053
1047 if(g_ascii_isspace(str2[k])) 1054 if(g_ascii_isspace(str2[k]))
1048 visible = TRUE; 1055 visible = TRUE;
1049 else 1056 else
1075 if (str2[i] == '&' && strncasecmp(str2 + i, "&quot;", 6) == 0) 1082 if (str2[i] == '&' && strncasecmp(str2 + i, "&quot;", 6) == 0)
1076 { 1083 {
1077 str2[j++] = '\"'; 1084 str2[j++] = '\"';
1078 i = i + 5; 1085 i = i + 5;
1079 continue; 1086 continue;
1087 }
1088
1089 if (str2[i] == '&' && strncasecmp(str2 + i, "&amp;", 5) == 0)
1090 {
1091 str2[j++] = '&';
1092 i = i + 4;
1093 continue;
1094 }
1095
1096 if (str2[i] == '&' && strncasecmp(str2 + i, "&lt;", 4) == 0)
1097 {
1098 str2[j++] = '<';
1099 i = i + 3;
1100 continue;
1101 }
1102
1103 if (str2[i] == '&' && strncasecmp(str2 + i, "&gt;", 4) == 0)
1104 {
1105 str2[j++] = '>';
1106 i = i + 3;
1107 continue;
1080 } 1108 }
1081 1109
1082 if (visible) 1110 if (visible)
1083 str2[j++] = str2[i]; 1111 str2[j++] = str2[i];
1084 } 1112 }