From cf8aaafbad6815ebdfcd9b3b36cfe3ca5ff2764b Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Tue, 5 Mar 2013 22:31:49 -0500 Subject: lib/database.cc: change how the parent of a message is calculated Presently, the code which finds the parent of a message as it is being added to the database assumes that the first Message-ID-like substring of the In-Reply-To header is the parent Message ID. Some mail clients, however, put stuff other than the Message-ID of the parent in the In-Reply-To header, such as the email address of the sender of the parent. This can fool notmuch. The updated algorithm prefers the last Message ID in the References header. The References header lists messages oldest-first, so the last Message ID is the parent (RFC2822, p. 24). The References header is also less likely to be in a non-standard syntax (http://cr.yp.to/immhf/thread.html, http://www.jwz.org/doc/threading.html). In case the References header is not to be found, fall back to the old behavior. V2 of this patch, incorporating feedback from Jani and (indirectly) Austin. --- test/thread-replies | 3 --- 1 file changed, 3 deletions(-) (limited to 'test') diff --git a/test/thread-replies b/test/thread-replies index 5fc5eedd..eeb70d06 100755 --- a/test/thread-replies +++ b/test/thread-replies @@ -12,7 +12,6 @@ test_description='test of proper handling of in-reply-to and references headers' . ./test-lib.sh test_begin_subtest "Use References when In-Reply-To is broken" -test_subtest_known_broken add_message '[id]="foo@one.com"' \ '[subject]=one' add_message '[in-reply-to]="mumble"' \ @@ -47,7 +46,6 @@ expected=`echo "$expected" | notmuch_json_show_sanitize` test_expect_equal_json "$output" "$expected" test_begin_subtest "Prefer References to In-Reply-To" -test_subtest_known_broken add_message '[id]="foo@two.com"' \ '[subject]=two' add_message '[in-reply-to]=""' \ @@ -104,7 +102,6 @@ expected=`echo "$expected" | notmuch_json_show_sanitize` test_expect_equal_json "$output" "$expected" test_begin_subtest "Use last Reference" -test_subtest_known_broken add_message '[id]="foo@four.com"' \ '[subject]="four"' add_message '[id]="bar@four.com"' \ -- cgit v1.2.3