When assembling lists of thread references, if the list
authorArt Cancro <ajc@citadel.org>
Thu, 17 Apr 2008 14:32:29 +0000 (14:32 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 17 Apr 2008 14:32:29 +0000 (14:32 +0000)
exceeds 10 messages or 900 bytes, eliminate the second reference
in the list.  See http://cr.yp.to/immhf/thread.html for more info.

citadel/messages.c
webcit/messages.c

index 71e09ab2ec6b9d85e17d9cc3c7439de81193adf0..6307b81bb1f301b5a2e02376d7af60242d60ab79 100644 (file)
@@ -1163,6 +1163,15 @@ int entmsg(CtdlIPC *ipc,
                        }
                }
 
+               /* Trim down excessively long lists of thread references.  We eliminate the
+                * second one in the list so that the thread root remains intact.
+                */
+               int rrtok = num_tokens(reply_references, '|');
+               int rrlen = strlen(reply_references);
+               if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) {
+                       remove_token(reply_references, 1, '|');
+               }
+
                snprintf(message.references, sizeof message.references, "%s%s%s",
                        reply_references,
                        (IsEmptyStr(reply_references) ? "" : "|"),
index 17c7537c39dc13d67aab821daf67a5d455948765..e8fbd23ca8434268b68017787b20171c2fb7ccd1 100644 (file)
@@ -997,7 +997,16 @@ void read_message(long msgnum, int printable_view, char *section) {
 
        }
 
-       /** Generate a reply-to address */
+       /* Trim down excessively long lists of thread references.  We eliminate the
+        * second one in the list so that the thread root remains intact.
+        */
+       int rrtok = num_tokens(reply_references, '|');
+       int rrlen = strlen(reply_references);
+       if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) {
+               remove_token(reply_references, 1, '|');
+       }
+
+       /* Generate a reply-to address */
        if (!IsEmptyStr(rfca)) {
                if (!IsEmptyStr(from)) {
                        snprintf(reply_to, sizeof(reply_to), "%s <%s>", from, rfca);