]> code.citadel.org Git - citadel.git/blobdiff - citadel/html.c
* msgbase.c: when a summary mode message list is requested, and the room
[citadel.git] / citadel / html.c
index e75fc0783ab50f16ed1740944ce9fa699ef00486..8ff0bbc936d058a80093c20a7f15565a370da0b4 100644 (file)
@@ -2,14 +2,10 @@
  * $Id$
  *
  * Functions which handle translation between HTML and plain text
- * Copyright (c) 2000-2001 by Art Cancro and others.   This program is
+ * Copyright (c) 2000-2005 by Art Cancro and others.   This program is
  * released under the terms of the GNU General Public License.
  */
 
-#ifdef DLL_EXPORT
-#define IN_LIBCIT
-#endif
-
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -52,7 +48,7 @@
  * screenwidth   = desired output screenwidth
  * do_citaformat = set to 1 to indent newlines with spaces
  */
-char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) {
+char *html_to_ascii(char *inputmsg, int msglen, int screenwidth, int do_citaformat) {
        char inbuf[SIZ];
        char outbuf[SIZ];
        char tag[1024];
@@ -64,10 +60,12 @@ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) {
        int i, j, ch, did_out, rb, scanch;
        int nest = 0;           /* Bracket nesting level */
        int blockquote = 0;     /* BLOCKQUOTE nesting level */
+       int bytes_processed = 0;
 
        inptr = inputmsg;
        strcpy(inbuf, "");
        strcpy(outbuf, "");
+       if (msglen == 0) msglen = strlen(inputmsg);
 
        outptr_buffer_size = strlen(inptr) + SIZ;
        outptr = malloc(outptr_buffer_size);
@@ -88,6 +86,11 @@ char *html_to_ascii(char *inputmsg, int screenwidth, int do_citaformat) {
                                done_reading = 1;
                        }
 
+                       ++bytes_processed;
+                       if (bytes_processed > msglen) {
+                               done_reading = 1;
+                       }
+
                }
 
                /* Do some parsing */