From 1a7a58d6e3eec003e75c5961c0cc5b5cc438d4a8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 19 Apr 2007 15:27:40 +0000 Subject: [PATCH] When converting HTML to plain text, omit any text that appears between tags. --- citadel/html.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/citadel/html.c b/citadel/html.c index a0d2e112c..3964dade2 100644 --- a/citadel/html.c +++ b/citadel/html.c @@ -60,6 +60,8 @@ char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaform int i, j, ch, did_out, rb, scanch; int nest = 0; /* Bracket nesting level */ int blockquote = 0; /* BLOCKQUOTE nesting level */ + int styletag = 0; /* STYLE tag nesting level */ + int styletag_start = 0; int bytes_processed = 0; char nl[128]; @@ -221,6 +223,20 @@ char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaform strcat(outbuf, nl); } + else if (!strcasecmp(tag, "STYLE")) { + ++styletag; + if (styletag == 1) { + styletag_start = strlen(outbuf); + } + } + + else if (!strcasecmp(tag, "/STYLE")) { + --styletag; + if (styletag == 0) { + outbuf[styletag_start] = 0; + } + } + } else if ((nest > 0) && (strlen(tag)<(sizeof(tag)-1))) { -- 2.39.2