changeset 7103:5dc4ed905a1a

[gaim-migrate @ 7668] this caused problems committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Wed, 01 Oct 2003 05:31:28 +0000
parents c4faffdc0862
children 7700a28929bd
files src/util.c
diffstat 1 files changed, 54 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.c	Wed Oct 01 04:29:44 2003 +0000
+++ b/src/util.c	Wed Oct 01 05:31:28 2003 +0000
@@ -1553,11 +1553,62 @@
 char *
 gaim_markup_strip_html(const char *str)
 {
-	char *ret;
+	int i, j, k;
+	gboolean visible = TRUE;
+	gchar *str2;
+
+	g_return_val_if_fail(str != NULL, NULL);
+
+	str2 = g_strdup(str);
+
+	for (i = 0, j = 0; str2[i]; i++)
+	{
+		if (str2[i] == '<')
+		{
+			k = i + 1;
+
+			if(g_ascii_isspace(str2[k]))
+				visible = TRUE;
+			else
+			{
+				while (str2[k])
+				{
+					if (str2[k] == '<')
+					{
+						visible = TRUE;
+						break;
+					}
 
-	gaim_markup_html_to_xhtml(str, NULL, &ret);
+					if (str2[k] == '>')
+					{
+						visible = FALSE;
+						break;
+					}
 
-	return ret;
+					k++;
+				}
+			}
+		}
+		else if (str2[i] == '>' && !visible)
+		{
+			visible = TRUE;
+			continue;
+		}
+
+		if (str2[i] == '&' && strncasecmp(str2 + i, "&quot;", 6) == 0)
+		{
+		    str2[j++] = '\"';
+		    i = i + 5;
+		    continue;
+		}
+
+		if (visible)
+			str2[j++] = str2[i];
+	}
+
+	str2[j] = '\0';
+
+	return str2;
 }
 
 gboolean