From c0f19bc92d77e082ba0a2a1fc661488342a41f63 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 7 Jun 2011 11:43:47 -0400 Subject: [PATCH] Use permalinks as the tag content for Blog room feeds --- webcit/feed_generator.c | 22 +++++++++++++++++++--- webcit/roomviews.c | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/webcit/feed_generator.c b/webcit/feed_generator.c index 8aa3f0912..40ee30f7c 100644 --- a/webcit/feed_generator.c +++ b/webcit/feed_generator.c @@ -36,6 +36,7 @@ void feed_rss_one_message(long msgnum) { const char *BufPtr = NULL; StrBuf *Line = NewStrBufPlain(NULL, 1024); char buf[1024]; + int permalink_hash = 0; /* Phase 1: read the message into memory */ serv_printf("MSG4 %ld", msgnum); @@ -49,10 +50,19 @@ void feed_rss_one_message(long msgnum) { /* Phase 2: help SkyNet become self-aware */ BufPtr = NULL; while (StrBufSipLine(Line, ServerResponse, &BufPtr), ((BufPtr!=StrBufNOTNULL)&&(BufPtr!=NULL)) ) { - if (StrLength(Line) == 0) ++in_body; - if ((StrLength(Line) > 5) && (!strncasecmp(ChrPtr(Line), "wefw=", 5))) { + if (in_body) { + /* do nothing */ + } + else if (StrLength(Line) == 0) { + ++in_body; + } + else if ((StrLength(Line) > 5) && (!strncasecmp(ChrPtr(Line), "wefw=", 5))) { is_top_level_post = 0; /* presence of references means it's a reply/comment */ } + else if ((StrLength(Line) > 5) && (!strncasecmp(ChrPtr(Line), "msgn=", 5))) { + StrBufCutLeft(Line, 5); + permalink_hash = ThreadIdHash(Line); + } } /* @@ -63,7 +73,13 @@ void feed_rss_one_message(long msgnum) { wc_printf(""); wc_printf("%s/readfwd?go=", ChrPtr(site_prefix)); urlescputs(ChrPtr(WC->CurRoom.name)); - wc_printf("?start_reading_at=%ld", msgnum); + if ((WC->CurRoom.view == VIEW_BLOG) && (permalink_hash != 0)) { + wc_printf("?p=%d", permalink_hash); + } + else { + wc_printf("?start_reading_at=%ld", msgnum); + } + wc_printf(""); BufPtr = NULL; in_body = 0; diff --git a/webcit/roomviews.c b/webcit/roomviews.c index c1f23fa1a..f8261cf50 100644 --- a/webcit/roomviews.c +++ b/webcit/roomviews.c @@ -22,7 +22,7 @@ ROOM_VIEWS allowed_default_views[VIEW_MAX] = { 0, /* VIEW_CALBRIEF Brief Calendar */ 0, /* VIEW_JOURNAL Journal */ 0, /* VIEW_DRAFTS Drafts */ - 0 /* VIEW_BLOG Blog */ + 1 /* VIEW_BLOG Blog */ }; /* -- 2.39.2