Mercurial > pidgin
comparison src/html.c @ 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 | a02584b98823 |
| children | 2fe660574083 |
comparison
equal
deleted
inserted
replaced
| 1882:922d8505ae5a | 1883:060161a5d5f8 |
|---|---|
| 39 #include <errno.h> | 39 #include <errno.h> |
| 40 #include "proxy.h" | 40 #include "proxy.h" |
| 41 | 41 |
| 42 gchar *strip_html(gchar *text) | 42 gchar *strip_html(gchar *text) |
| 43 { | 43 { |
| 44 int i, j; | 44 int i, j, k; |
| 45 int visible = 1; | 45 int visible = 1; |
| 46 gchar *text2 = g_malloc(strlen(text) + 1); | 46 gchar *text2 = g_strdup(text); |
| 47 | 47 |
| 48 strcpy(text2, text); | |
| 49 for (i = 0, j = 0; text2[i]; i++) { | 48 for (i = 0, j = 0; text2[i]; i++) { |
| 50 if (text2[i] == '<') { | 49 if (text2[i] == '<') { |
| 51 visible = 0; | 50 k = i + 1; |
| 52 continue; | 51 while (text2[k]) { |
| 53 } else if (text2[i] == '>') { | 52 if (text2[k] == '<') { |
| 53 visible = 1; | |
| 54 break; | |
| 55 } | |
| 56 if (text2[k] == '>') { | |
| 57 visible = 0; | |
| 58 break; | |
| 59 } | |
| 60 k++; | |
| 61 } | |
| 62 } else if (text2[i] == '>' && !visible) { | |
| 54 visible = 1; | 63 visible = 1; |
| 55 continue; | 64 continue; |
| 56 } | 65 } |
| 57 if (visible) { | 66 if (visible) { |
| 58 text2[j++] = text2[i]; | 67 text2[j++] = text2[i]; |
