From: Art Cancro Date: Thu, 19 Apr 2007 15:27:40 +0000 (+0000) Subject: When converting HTML to plain text, omit any text X-Git-Tag: v7.86~3430 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=1a7a58d6e3eec003e75c5961c0cc5b5cc438d4a8;p=citadel.git When converting HTML to plain text, omit any text that appears between tags. --- 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))) {