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)
committerArt Cancro <ajc@uncensored.citadel.org>
Tue, 31 May 2011 18:05:31 +0000 (14:05 -0400)
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 09df2c34f60a1893e2c462cd8b7693845ddfec50..f24aea1ae7bbf63449ff7a0125ddd1b1b5a430ed 100644 (file)
@@ -883,6 +883,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
  */