Define a consistent way to turn message id into thread id hash
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 31 May 2011 18:05:31 +0000 (14:05 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 20:56:03 +0000 (20:56 +0000)
webcit/blogview_renderer.c
webcit/webcit.h

index 1320c5497a92b95555e96da34fba958fb4fd2858..9c66093c8ac2631a16bdd1d4e00b789c4c063729 100644 (file)
@@ -146,12 +146,12 @@ struct bltr blogview_learn_thread_references(long msgnum)
                {
                        if (!strncasecmp(ChrPtr(Buf), "msgn=", 5)) {
                                StrBufCutLeft(Buf, 5);
-                               bltr.id = abs(HashLittle(ChrPtr(Buf), StrLength(Buf)));
+                               bltr.id = ThreadIdHash(Buf);
                        }
                        else if (!strncasecmp(ChrPtr(Buf), "wefw=", 5)) {
                                StrBufCutLeft(Buf, 5);          /* trim the field name */
                                StrBufExtract_token(r, Buf, 0, '|');
-                               bltr.refs = abs(HashLittle(ChrPtr(r), StrLength(r)));
+                               bltr.refs = ThreadIdHash(r);
                        }
                }
        }
index 022ed2d83f145adbfb3d1bb183e87f799428cfaa..ccd2b779d571590cab76edd8d71160319a95ff46 100644 (file)
@@ -887,6 +887,9 @@ void http_datestring(char *buf, size_t n, time_t xtime);
 
 extern int time_to_die;                        /* Nonzero if server is shutting down */
 
+/* a nice consistent place to define how we turn a message id into a thread id hash */
+#define ThreadIdHash(Buf) abs(HashLittle(ChrPtr(Buf), StrLength(Buf)))
+
 /* 
  * Array type for a blog post.  The first message is the post; the rest are comments
  */