From 16fedf63658a6b786d563357f64da818c85944f6 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 14 Sep 2010 12:55:01 -0400 Subject: [PATCH] Offer meta tags in head for RSS feeds (uses templates) --- citadel/room_ops.c | 19 ++++++++++++++++--- webcit/feed_generator.c | 24 ++++++++++++++++++++++-- webcit/static/t/head.html | 1 + 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 22e0cb2dd..9aa14741c 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -147,12 +147,25 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, * - It is a read-only room */ int post_allowed = 1; - if (userbuf->axlevel < AxProbU) post_allowed = 0; - if ((userbuf->axlevel < AxNetU) && (roombuf->QRflags & QR_NETWORK)) post_allowed = 0; - if (roombuf->QRflags & QR_READONLY) post_allowed = 0; + int reply_allowed = 1; + if (userbuf->axlevel < AxProbU) { + post_allowed = 0; + reply_allowed = 0; + } + if ((userbuf->axlevel < AxNetU) && (roombuf->QRflags & QR_NETWORK)) { + post_allowed = 0; + reply_allowed = 0; + } + if (roombuf->QRflags & QR_READONLY) { + post_allowed = 0; + reply_allowed = 0; + } if (post_allowed) { retval = retval | UA_POSTALLOWED | UA_REPLYALLOWED; } + if (reply_allowed) { + retval = retval | UA_REPLYALLOWED; + } /* If "collaborative deletion" is active for this room, any user who can post * is also allowed to delete diff --git a/webcit/feed_generator.c b/webcit/feed_generator.c index f259b00ee..ab8a4630e 100644 --- a/webcit/feed_generator.c +++ b/webcit/feed_generator.c @@ -165,6 +165,26 @@ void feed_rss(void) { } +/* + * Offer the RSS feed meta tag for this room + */ +void tmplput_rssmeta(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + char feed_link[1024]; + char encoded_link[1024]; + + strcpy(feed_link, "/feed_rss?gotofirst="); + urlesc(&feed_link[20], sizeof(feed_link) - 20, (char *)ChrPtr(WCC->CurRoom.name) ); + CtdlEncodeBase64(encoded_link, feed_link, strlen(feed_link), 0); + + StrBufAppendPrintf(Target, + "", + encoded_link + ); +} + + /* * Offer the RSS feed button for this room */ @@ -178,17 +198,17 @@ void tmplput_rssbutton(StrBuf *Target, WCTemplputParams *TP) urlesc(&feed_link[20], sizeof(feed_link) - 20, (char *)ChrPtr(WCC->CurRoom.name) ); CtdlEncodeBase64(encoded_link, feed_link, strlen(feed_link), 0); - StrBufAppendPrintf(Target, "", encoded_link); + StrBufAppendPrintf(Target, "", encoded_link); StrBufAppendPrintf(Target, ""); StrBufAppendPrintf(Target, ""); } - void InitModule_RSS (void) { WebcitAddUrlHandler(HKEY("feed_rss"), "", 0, feed_rss, ANONYMOUS|COOKIEUNNEEDED); RegisterNamespace("THISROOM:FEED:RSS", 0, 0, tmplput_rssbutton, NULL, CTX_NONE); + RegisterNamespace("THISROOM:FEED:RSSMETA", 0, 0, tmplput_rssmeta, NULL, CTX_NONE); } diff --git a/webcit/static/t/head.html b/webcit/static/t/head.html index 939dd2104..fc450450f 100644 --- a/webcit/static/t/head.html +++ b/webcit/static/t/head.html @@ -8,6 +8,7 @@ + -- 2.30.2