]> code.citadel.org Git - citadel.git/blobdiff - webcit/rss.c
* add new 'Context' Parameter to the template call
[citadel.git] / webcit / rss.c
index 73297a54991fd844dcc5c90c7a041581d4d1714d..fb6cb59267567c397f7a14221c8f6261df62994a 100644 (file)
@@ -91,20 +91,20 @@ void display_rss(char *roomname, char *request_method)
 
        if (gotoroom((char *)roomname)) {
                lprintf(3, "RSS: Can't goto requested room\n");
-               wprintf("HTTP/1.1 404 Not Found\r\n");
-               wprintf("Content-Type: text/html\r\n");
-               wprintf("\r\n");
+               hprintf("HTTP/1.1 404 Not Found\r\n");
+               hprintf("Content-Type: text/html\r\n");
                wprintf("Error retrieving RSS feed: couldn't find room\n");
+               end_burst();
                return;
        }
 
         nummsgs = load_msg_ptrs("MSGS LAST|15", 0);
        if (nummsgs == 0) {
                lprintf(3, "RSS: No messages found\n");
-               wprintf("HTTP/1.1 404 Not Found\r\n");
-               wprintf("Content-Type: text/html\r\n");
-               wprintf("\r\n");
+               hprintf("HTTP/1.1 404 Not Found\r\n");
+               hprintf("Content-Type: text/html\r\n");
                wprintf(_("Error retrieving RSS feed: couldn't find messages\n"));
+               end_burst();
                return;
        } 
        
@@ -127,26 +127,25 @@ void display_rss(char *roomname, char *request_method)
        // Commented out. Play dumb for now, also doesn't work with anonrss hack
        /* if (if_modified_since > 0 && if_modified_since > now) {
                lprintf(3, "RSS: Feed not updated since the last time you looked\n");
-               wprintf("HTTP/1.1 304 Not Modified\r\n");
-               wprintf("Last-Modified: %s\r\n", date);
+               hprintf("HTTP/1.1 304 Not Modified\r\n");
+               hprintf("Last-Modified: %s\r\n", date);
                now = time(NULL);
                gmtime_r(&now, &now_tm);
                strftime(date, sizeof date, "%a, %d %b %Y %H:%M:%S GMT", &now_tm);
-               wprintf("Date: %s\r\n", date);
-               if (*msgn) wprintf("ETag: %s\r\n\r\n", msgn); */
+               hprintf("Date: %s\r\n", date);
+               if (*msgn) hprintf("ETag: %s\r\n", msgn); */
                // wDumpContent(0);
                // return;
        //} 
 
        /* Do RSS header */
        lprintf(3, "RSS: Yum yum! This feed is tasty!\n");
-       wprintf("HTTP/1.1 200 OK\r\n");
-       wprintf("Last-Modified: %s\r\n", date);
+       hprintf("HTTP/1.1 200 OK\r\n");
+       hprintf("Last-Modified: %s\r\n", date);
 /*     if (*msgn) wprintf("ETag: %s\r\n\r\n", msgn); */
-       wprintf("Content-Type: application/rss+xml\r\n");
-       wprintf("Server: %s\r\n", PACKAGE_STRING);
-       wprintf("Connection: close\r\n");
-       wprintf("\r\n");
+       hprintf("Content-Type: application/rss+xml\r\n");
+       hprintf("Server: %s\r\n", PACKAGE_STRING);
+       hprintf("Connection: close\r\n");
        if (!strcasecmp(request_method, "HEAD"))
                return;
 
@@ -175,7 +174,7 @@ void display_rss(char *roomname, char *request_method)
                svput("822_PUB_DATE", WCS_STRING, date);
        }
        svput("GENERATOR", WCS_STRING, PACKAGE_STRING);
-       do_template("rss_head");
+       do_template("rss_head", NULL);
 
        /** Read all messages and output as RSS items */
        for (a = 0; a < nummsgs; ++a) {
@@ -231,7 +230,7 @@ void display_rss(char *roomname, char *request_method)
                        svprintf(HKEY("822_PUB_DATE"),WCS_STRING, _("%s"), date);
                }
                svprintf(HKEY("GUID"), WCS_STRING,"%s", msgn);
-               do_template("rss_item");
+               do_template("rss_item", NULL);
                /** Now the hard part, the message itself */
                strcpy(content_type, "text/plain");
                while (serv_getln(buf, sizeof buf), !IsEmptyStr(buf)) {
@@ -344,7 +343,7 @@ void display_rss(char *roomname, char *request_method)
 
 ENDBODY:
                //wprintf("   </item>\n");
-               do_template("rss_item_end");
+               do_template("rss_item_end", NULL);
 ENDITEM:
                now = 0L;
        }