]> code.citadel.org Git - citadel.git/blobdiff - webcit/blogview_renderer.c
Rendering tests
[citadel.git] / webcit / blogview_renderer.c
index 1a18297f07ec035bfbbfb4ede8c688936e5ba72d..d4f1ee4a913c921cfab0a55792c319e67cadf177 100644 (file)
@@ -128,14 +128,18 @@ void blogview_learn_thread_references(struct blogpost *bp)
                while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
                        if (!strncasecmp(ChrPtr(Buf), "msgn=", 5)) {
                                StrBufCutLeft(Buf, 5);
+                               wc_printf("id %s, ", ChrPtr(Buf));
                                bp->id = HashLittle(ChrPtr(Buf), StrLength(Buf));
                        }
                        else if (!strncasecmp(ChrPtr(Buf), "wefw=", 5)) {
                                StrBufCutLeft(Buf, 5);          /* trim the field name */
+                               wc_printf("refs %s, ", ChrPtr(Buf));
                                StrBufCutAt(Buf, 0, "|");       /* trim all but the first thread ref */
+                               wc_printf("topref %s, ", ChrPtr(Buf));
                                bp->refs = HashLittle(ChrPtr(Buf), StrLength(Buf));
                        }
                }
+               wc_printf("<br>\n");
        }
        FreeStrBuf(&Buf);
 }
@@ -146,7 +150,7 @@ void blogview_learn_thread_references(struct blogpost *bp)
 int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper)
 {
        struct blogview *BLOG = (struct blogview *) *ViewSpecific;
-       int i;
+       int i, j;
 
        /* Pass #1 - sort */
        if (Stat->nummsgs > 0) {
@@ -172,21 +176,37 @@ int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper)
         * * Comments
         * * etc
         */
+
+       wc_printf("<hr>\n");
+
        for (i=0; (i<BLOG->num_msgs); ++i) {
                if (BLOG->msgs[i].msgnum > 0L) {
-                       if (BLOG->msgs[i].refs == 0) {
-                               wc_printf("<b>");
-                       }
-                       wc_printf("Message %d, #%ld, id %d, refs %d",
+                       wc_printf("Message %d, #%ld, id %d, refs %d<br>\n",
                                i,
                                BLOG->msgs[i].msgnum,
                                BLOG->msgs[i].id,
                                BLOG->msgs[i].refs
                        );
+               }
+       }
+
+       wc_printf("<hr>\n");
+
+       for (i=0; (i<BLOG->num_msgs); ++i) {
+               if (BLOG->msgs[i].msgnum > 0L) {
                        if (BLOG->msgs[i].refs == 0) {
-                               wc_printf("</b>");
+                               wc_printf("<b>Message %d, #%ld, id %d, refs %d</b><br>\n",
+                                       i,
+                                       BLOG->msgs[i].msgnum,
+                                       BLOG->msgs[i].id,
+                                       BLOG->msgs[i].refs
+                               );
+                               for (j=0; (j<BLOG->num_msgs); ++j) {
+                                       if (BLOG->msgs[j].refs == BLOG->msgs[i].id) {
+                                               wc_printf("* comment %d<br>\n", j);
+                                       }
+                               }
                        }
-                       wc_printf("<br>\n");
                }
        }