fleshed out the blog read loop a bit.
authorArt Cancro <ajc@citadel.org>
Thu, 23 Sep 2010 03:37:42 +0000 (23:37 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 23 Sep 2010 03:37:42 +0000 (23:37 -0400)
webcit/blogview_renderer.c
webcit/feed_generator.c

index 6ae055ece1a84d7a9252ffa1dbd74193cea202cf..760045e95ffceb9703c548480d3724a7ae207819 100644 (file)
@@ -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("<div class=\"fix_scrollbar_bug\">");
 
@@ -118,7 +120,19 @@ int blogview_RenderView_or_Tail(SharedMessageStatus *Stat,
 
        for (i=0; (i<BLOG->num_msgs); ++i) {
                if (BLOG->msgs[i] > 0L) {
-                       read_message(WC->WBuf, HKEY("view_message"), BLOG->msgs[i], NULL, &Mime);
+                       wc_printf("<p>Message %d %ld</p>\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<br>\n", ChrPtr(Buf));
+                               }
+                       }
+                       FreeStrBuf(&Buf);
                }
        }
 
@@ -151,7 +165,7 @@ InitModule_BLOGVIEWRENDERERS
                NULL,
                NULL, 
                blogview_LoadMsgFromServer,
-               blogview_RenderView_or_Tail,
+               blogview_render,
                blogview_Cleanup
        );
 }
index ab8a4630eb84f3816d27984c228bcc383e1214e0..5ec8aad2155d205ba5a61ae49b19f8440125835f 100644 (file)
@@ -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
  *