changeset 1883:060161a5d5f8

[gaim-migrate @ 1893] David Stoddard's strip_html patch. temas, don't use this. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 23 May 2001 21:02:44 +0000
parents 922d8505ae5a
children f7114b4d1f96
files src/html.c
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/html.c	Wed May 23 11:39:05 2001 +0000
+++ b/src/html.c	Wed May 23 21:02:44 2001 +0000
@@ -41,16 +41,25 @@
 
 gchar *strip_html(gchar *text)
 {
-	int i, j;
+	int i, j, k;
 	int visible = 1;
-	gchar *text2 = g_malloc(strlen(text) + 1);
+	gchar *text2 = g_strdup(text);
 
-	strcpy(text2, text);
 	for (i = 0, j = 0; text2[i]; i++) {
 		if (text2[i] == '<') {
-			visible = 0;
-			continue;
-		} else if (text2[i] == '>') {
+			k = i + 1;
+			while (text2[k]) {
+				if (text2[k] == '<') {
+					visible = 1;
+					break;
+				}
+				if (text2[k] == '>') {
+					visible = 0;
+					break;
+				}
+				k++;
+			}
+		} else if (text2[i] == '>' && !visible) {
 			visible = 1;
 			continue;
 		}