RSS feed generator
authorArt Cancro <ajc@citadel.org>
Wed, 8 Sep 2010 21:18:35 +0000 (17:18 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 8 Sep 2010 21:18:35 +0000 (17:18 -0400)
webcit/Makefile.in
webcit/feed_generator.c [new file with mode: 0644]

index 8b1f25017c8d1a28beafc5761e7868601d3d1de3..9189c9096b7c9fe282dbcd6b92e9c30ed9140a78 100644 (file)
@@ -57,7 +57,7 @@ webcit: webserver.o context_loop.o ical_dezonify.o \
        groupdav_delete.o groupdav_put.o http_datestring.o setup_wizard.o \
        downloads.o addressbook_popup.o pushemail.o sysdep.o openid.o \
        decode.o modules_init.o paramhandling.o utils.o \
-       ical_maps.o ical_subst.o static.o \
+       ical_maps.o ical_subst.o static.o feed_generator.o \
        $(LIBOBJS)
        $(CC) $(LDFLAGS) -o webcit $(LIBOBJS) \
        webserver.o context_loop.o cookie_conversion.o marchlist.o \
@@ -72,7 +72,7 @@ webcit: webserver.o context_loop.o ical_dezonify.o \
        groupdav_options.o autocompletion.o tabs.o smtpqueue.o sieve.o \
        groupdav_put.o http_datestring.o setup_wizard.o fmt_date.o modules_init.o \
        gettext.o downloads.o addressbook_popup.o pushemail.o sysdep.o decode.o \
-       paramhandling.o utils.o ical_maps.o ical_subst.o static.o \
+       paramhandling.o utils.o ical_maps.o ical_subst.o static.o feed_generator.o \
        $(LIBS)
 
 .c.o:
diff --git a/webcit/feed_generator.c b/webcit/feed_generator.c
new file mode 100644 (file)
index 0000000..107856d
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * RSS/Atom feed generator
+ *
+ * Copyright (c) 2005-2010 by the citadel.org team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "webcit.h"
+#include "webserver.h"
+
+
+
+/*
+ * Main entry point for GroupDAV requests
+ */
+void feed_rss(void) {
+
+       output_headers(0, 0, 0, 1, 1, 0);
+       hprintf("Content-type: text/xml\r\n");
+       hprintf(
+               "Server: %s / %s\r\n"
+               "Connection: close\r\n"
+       ,
+               PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software)
+       );
+       begin_burst();
+
+       wc_printf("<?xml version=\"1.0\"?>"
+               "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">"
+               "<channel>"
+       );
+
+       wc_printf("<title>");
+       escputs(ChrPtr(WC->CurRoom.name));
+       wc_printf("</title>");
+
+       wc_printf("<link>");
+       urlescputs(ChrPtr(site_prefix));
+       wc_printf("</link>");
+
+       //      <language>en-us</language>
+       //      <description>Linux Today News Service</description>
+       //      <atom:link href="http://linuxtoday.com/biglt.rss" rel="self" type="application/rss+xml" />
+
+       //    <image>
+       //      <title>Linux Today</title>
+       //      <url>http://linuxtoday.com/pics/ltnet.png</url>
+       //      <link>http://linuxtoday.com</link>
+       //    </image>
+
+#if 0
+    <item>
+      <title>lorem ipsum dolor sit amet</title>
+      <pubDate>Wed, 08 Sep 2010 20:03:21 GMT</pubDate>
+      <link>http://xxxxx.xxxx.xxxxxx.xxxx.xxx</link>
+      <description>&#60;b&#62;foo bar baz:&#60;/b&#62; lorem ipsum dolor sit amet, foo bar eek</description>
+      <guid>xxxx-xxxx-xxxx-xxxx-xxxx-xxxx</guid>
+    </item>
+#endif
+
+       wc_printf("</channel>"
+               "</rss>"
+               "\r\n\r\n"
+       );
+
+       wDumpContent(0);
+       end_webcit_session();
+}
+
+
+void 
+InitModule_RSS
+(void)
+{
+       WebcitAddUrlHandler(HKEY("feed_rss"), "", 0, feed_rss, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
+}