feed_generator.c: buffer message text into a StrBuf so we can output it as a single...
authorArt Cancro <ajc@uncensored.citadel.org>
Thu, 26 May 2011 14:59:38 +0000 (10:59 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 20:53:48 +0000 (20:53 +0000)
webcit/feed_generator.c

index e30e481a935b6a495adbcd5cb5085213496754d9..f0c34059c46324a1ace8fd7758632fd1d29bfb52 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * RSS feed generator (could be adapted in the future to feed both RSS and Atom)
  *
- * Copyright (c) 2010 by the citadel.org team
+ * Copyright (c) 2010-2011 by the citadel.org team
  *
  * This program is open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -30,6 +30,7 @@ void feed_rss_one_message(long msgnum) {
        int in_body = 0;
        int found_title = 0;
        char pubdate[128];
+       StrBuf *messagetext = NULL;
 
        /* FIXME if this is a blog room we only want to include top-level messages */
 
@@ -44,8 +45,8 @@ void feed_rss_one_message(long msgnum) {
 
        while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                if (in_body) {
-                       cdataout(buf);
-                       wc_printf("\r\n");
+                       StrBufAppendBufPlain(messagetext, buf, -1, 0);
+                       StrBufAppendBufPlain(messagetext, HKEY("\r\n"), 0);
                }
                else if (!strncasecmp(buf, "subj=", 5)) {
                        wc_printf("<title>");
@@ -68,10 +69,13 @@ void feed_rss_one_message(long msgnum) {
                        }
                        wc_printf("<description>");
                        in_body = 1;
+                       messagetext = NewStrBuf();
                }
        }
 
        if (in_body) {
+               cdataout((char*)ChrPtr(messagetext));
+               FreeStrBuf(&messagetext);
                wc_printf("</description>");
        }