From: Art Cancro Date: Thu, 23 Sep 2010 03:37:42 +0000 (-0400) Subject: fleshed out the blog read loop a bit. X-Git-Tag: v8.01~702^2 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=0c8c4621687479b210735ca026c885aee8a7dd81;hp=72f2864f0fbe99f11cc74fa2b16a52344fa8e4bc;p=citadel.git fleshed out the blog read loop a bit. --- 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 *