From 0c8c4621687479b210735ca026c885aee8a7dd81 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 22 Sep 2010 23:37:42 -0400 Subject: [PATCH] fleshed out the blog read loop a bit. --- webcit/blogview_renderer.c | 26 ++++++++++++++++++++------ webcit/feed_generator.c | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/webcit/blogview_renderer.c b/webcit/blogview_renderer.c index 6ae055ece..760045e95 100644 --- a/webcit/blogview_renderer.c +++ b/webcit/blogview_renderer.c @@ -88,6 +88,9 @@ int blogview_LoadMsgFromServer(SharedMessageStatus *Stat, } +/* + * People expect blogs to be sorted newest-to-oldest + */ int blogview_sortfunc(const void *s1, const void *s2) { long l1; long l2; @@ -95,19 +98,18 @@ int blogview_sortfunc(const void *s1, const void *s2) { l1 = *(long *)(s1); l2 = *(long *)(s2); - if (l1 > l2) return(+1); - if (l1 < l2) return(-1); + if (l1 > l2) return(-1); + if (l1 < l2) return(+1); return(0); } -int blogview_RenderView_or_Tail(SharedMessageStatus *Stat, +int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper) { struct blogview *BLOG = (struct blogview *) *ViewSpecific; int i; - const StrBuf *Mime; wc_printf("
"); @@ -118,7 +120,19 @@ int blogview_RenderView_or_Tail(SharedMessageStatus *Stat, for (i=0; (inum_msgs); ++i) { if (BLOG->msgs[i] > 0L) { - read_message(WC->WBuf, HKEY("view_message"), BLOG->msgs[i], NULL, &Mime); + wc_printf("

Message %d %ld

\n", i, BLOG->msgs[i]); + + /* maybe put some of this into its own function later */ + StrBuf *Buf; + Buf = NewStrBuf(); + serv_printf("MSG0 %ld|1", BLOG->msgs[i]); /* top level citadel headers only */ + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, NULL) == 1) { + while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) { + wc_printf("%s
\n", ChrPtr(Buf)); + } + } + FreeStrBuf(&Buf); } } @@ -151,7 +165,7 @@ InitModule_BLOGVIEWRENDERERS NULL, NULL, blogview_LoadMsgFromServer, - blogview_RenderView_or_Tail, + blogview_render, blogview_Cleanup ); } diff --git a/webcit/feed_generator.c b/webcit/feed_generator.c index ab8a4630e..5ec8aad21 100644 --- a/webcit/feed_generator.c +++ b/webcit/feed_generator.c @@ -1,5 +1,5 @@ /* - * RSS/Atom feed generator + * RSS feed generator (could be adapted in the future to feed both RSS and Atom) * * Copyright (c) 2010 by the citadel.org team * -- 2.30.2