Stop processing if the viewer is only interested in a single post and that message...
authorArt Cancro <ajc@uncensored.citadel.org>
Fri, 3 Jun 2011 21:53:18 +0000 (17:53 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 20:57:40 +0000 (20:57 +0000)
webcit/blogview_renderer.c

index ad287361e59a19e75134255d22c74e01c7a60da5..6492f20ad563b2b817ea0ef67c15f26df7b3adca 100644 (file)
@@ -176,14 +176,21 @@ int blogview_LoadMsgFromServer(SharedMessageStatus *Stat,
        HashList *BLOG = (HashList *) *ViewSpecific;
        struct bltr b;
        struct blogpost *bp = NULL;
+       int p = 0;
 
        b = blogview_learn_thread_references(Msg->msgnum);
 
-       /* FIXME an optimization here -- one we ought to perform -- is to exit this
-        * function immediately if the viewer is only interested in a single post and
+       /* Stop processing if the viewer is only interested in a single post and
         * that message ID is neither the id nor the refs.
         */
+       p = atoi(BSTR("p"));    /* are we looking for a specific post? */
+       if ((p != 0) && (p != b.id) && (p != b.refs)) {
+               return 200;
+       }
 
+       /*
+        * Add our little bundle of blogworthy wonderfulness to the hash table
+        */
        if (b.refs == 0) {
                bp = malloc(sizeof(struct blogpost));
                if (!bp) return(200);