From: Art Cancro Date: Tue, 24 Jun 2008 02:15:41 +0000 (+0000) Subject: * Applied matt's latest patches X-Git-Tag: v7.86~2128 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=5fbe6be7535361f2797b415fd0e32df4918097ec;p=citadel.git * Applied matt's latest patches * Corrected a spelling error in the previous commit --- diff --git a/webcit/auth.c b/webcit/auth.c index 22b8eb200..94bc438cb 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -694,7 +694,7 @@ void validate(void) count = 0; switch (count){ case 0: - pch = _("verry weak"); + pch = _("very weak"); break; case 1: pch = _("weak"); diff --git a/webcit/calendar.c b/webcit/calendar.c index 8c62a36b1..ddd6fa251 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -592,7 +592,7 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch wprintf("\n"); wprintf(_("Completed:")); wprintf(""); - wprintf("logged_in) { + #ifdef ALLOW_ANON_RSS + serv_printf("USER %s", ANON_RSS_USER); + serv_getln(buf, sizeof buf); + serv_printf("PASS %s", ANON_RSS_PASS); + serv_getln(buf, sizeof buf); + become_logged_in(ANON_RSS_USER, ANON_RSS_PASS, buf); + WC->killthis = 1; + #else authorization_required(_("Not logged in")); return; + #endif } if (gotoroom((char *)roomname)) { @@ -83,7 +98,7 @@ void display_rss(char *roomname, char *request_method) return; } - nummsgs = load_msg_ptrs("MSGS LAST|15", 0); + 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"); @@ -91,7 +106,8 @@ void display_rss(char *roomname, char *request_method) wprintf("\r\n"); wprintf(_("Error retrieving RSS feed: couldn't find messages\n")); return; - } + } + /** Read time of last message immediately */ serv_printf("MSG4 %ld", WC->msgarr[nummsgs - 1]); @@ -108,8 +124,8 @@ void display_rss(char *roomname, char *request_method) } } } - - if (if_modified_since > 0 && if_modified_since > now) { + // 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); @@ -117,10 +133,10 @@ void display_rss(char *roomname, char *request_method) 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); */ - wDumpContent(0); - return; - } + if (*msgn) wprintf("ETag: %s\r\n\r\n", msgn); */ + // wDumpContent(0); + // return; + //} /* Do RSS header */ lprintf(3, "RSS: Yum yum! This feed is tasty!\n"); @@ -128,38 +144,38 @@ void display_rss(char *roomname, char *request_method) wprintf("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("$erver: %s\r\n", PACKAGE_STRING); + wprintf("Server: %s\r\n", PACKAGE_STRING); wprintf("Connection: close\r\n"); wprintf("\r\n"); if (!strcasecmp(request_method, "HEAD")) return; - wprintf("\n"); - wprintf("\n"); - wprintf(" \n"); - wprintf(" %s - %s\n", WC->wc_roomname, serv_info.serv_humannode); - wprintf(" %s://%s:%d/dotgoto?room=", (is_https ? "https" : "http"), WC->http_host, PORT_NUM); - escputs(roomname); - wprintf("\n"); - wprintf(" "); + /* "); + svput("XML_STYLE", WCS_STRING, ""); + svput("ROOM", WCS_STRING, WC->wc_roomname); + svput("NODE", WCS_STRING, serv_info.serv_humannode); + // Fix me + svprintf(HKEY("ROOM_LINK"), WCS_STRING, "%s://%s/", (is_https ? "https" : "http"), WC->http_host); + /** Get room info for description */ serv_puts("RINF"); serv_getln(buf, sizeof buf); + char description[SIZ] = ""; if (buf[0] == '1') { while (1) { serv_getln(buf, sizeof buf); if (!strcmp(buf, "000")) break; - wprintf("%s\n", buf); + strncat(description, buf, strlen(buf)); } } - wprintf("\n"); + svput("ROOM_DESCRIPTION", WCS_STRING, description); if (now) { - wprintf(" %s\n", date); + svput("822_PUB_DATE", WCS_STRING, date); } - wprintf(" %s\n", PACKAGE_STRING); - wprintf(" http://blogs.law.harvard.edu/tech/rss\n"); - wprintf(" 30\n"); + svput("GENERATOR", WCS_STRING, PACKAGE_STRING); + do_template("rss_head"); /** Read all messages and output as RSS items */ for (a = 0; a < nummsgs; ++a) { @@ -202,22 +218,20 @@ void display_rss(char *roomname, char *request_method) strftime(date, sizeof date, "%a, %d %b %Y %H:%M:%S GMT", &now_tm); } } - wprintf(" \n"); if (subj[0]) { - wprintf(" %s from", subj); + svprintf(HKEY("SUBJ"), WCS_STRING, _("%s from"), subj); } else { - wprintf(" <title>From"); + svput("SUBJ", WCS_STRING, _("From")); } - wprintf(" %s", from); - wprintf(" in %s", room); + svprintf(HKEY("IN_ROOM"), WCS_STRING, _("%s in %s"), from, room); if (strcmp(hnod, serv_info.serv_humannode) && !IsEmptyStr(hnod)) { - wprintf(" on %s", hnod); + svprintf(HKEY("NODE"), WCS_STRING, _(" on %s"), hnod); } - wprintf("\n"); if (now) { - wprintf(" %s\n", date); + svprintf(HKEY("822_PUB_DATE"),WCS_STRING, _("%s"), date); } - wprintf(" %s\n", msgn); + svprintf(HKEY("GUID"), WCS_STRING,"%s", msgn); + do_template("rss_item"); /** Now the hard part, the message itself */ strcpy(content_type, "text/plain"); while (serv_getln(buf, sizeof buf), !IsEmptyStr(buf)) { @@ -243,7 +257,7 @@ void display_rss(char *roomname, char *request_method) } /** Set up a character set conversion if we need to */ -#ifdef HAVE_ICONV + #ifdef HAVE_ICONV if (strcasecmp(charset, "us-ascii") && strcasecmp(charset, "utf-8") && strcasecmp(charset, "") ) { ic = ctdl_iconv_open("UTF-8", charset); if (ic == (iconv_t)(-1)) { @@ -252,13 +266,12 @@ void display_rss(char *roomname, char *request_method) goto ENDBODY; } } -#endif +#endif /** Messages in legacy Citadel variformat get handled thusly... */ if (!strcasecmp(content_type, "text/x-citadel-variformat")) { int intext = 0; - wprintf(" \n"); - } + } /** Boring old 80-column fixed format text gets handled this way... */ else if (!strcasecmp(content_type, "text/plain")) { - wprintf("
\n"); } display_rss_control(from, subj); - wprintf("]]>
\n"); - } + } /** HTML is fun, but we've got to strip it first */ else if (!strcasecmp(content_type, "text/html")) { - wprintf(" \n"); - } + output_html(charset, 0); + } ENDBODY: - wprintf("
\n"); + //wprintf(" \n"); + do_template("rss_item_end"); ENDITEM: now = 0L; } @@ -344,6 +353,9 @@ ENDITEM: wprintf("
\n"); wprintf("
\n"); wDumpContent(0); + #ifdef ALLOW_ANON_RSS + end_webcit_session(); + #endif }