Commit Graph

5 Commits

Author SHA1 Message Date
Koni Marti 1b6ce56164 threading: fix msg-id order in references header
Fix order in the references header when an in-reply-to msg-id is
erroneously added at the beginning instead of at the end. Add
description to the function that cleans up the reference headers for
threading.

Reported-by: Evan Gates <evan.gates@gmail.com>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-23 20:56:47 +01:00
Koni Marti 93c160ab66 threading: fix stack overflow from faulty headers
Fix stack overflow from faulty headers that cause a circularity in the
threading algorithm. Remove duplicated message-ids in the references
headers. Check that the message-id itself is not part of the references.

Fixes: https://todo.sr.ht/~rjarry/aerc/32
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Robin Jarry <robin@jarry.cc>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-22 09:45:59 +01:00
Moritz Poldrack 22d65d5759 go vet: unreachable code
This commit fixes all occurrences of the abovementioned lint-error in
the codebase.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-18 13:33:21 +01:00
Koni Marti 65ae87a524 threading: honor user-defined sort criteria
Apply the user-defined sort criteria to the message with the highest
uid in a threaded discussion. Restore the default sort order when
leaving threading mode.

Commit 7811620eb8 ("threading: implement on-the-fly message
threading") introduced message threading with the threaded messages
being only sorted by their message uids irrespective of the defined sorting
criteria. It did not restore the default sort order either.

Reported-by: Sebastien Binet <s@sbinet.org>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-03-09 00:08:26 +01:00
Koni Marti 7811620eb8 threading: implement on-the-fly message threading
implement message threading on the message store level using the
jwz algorithm. Build threads on-the-fly when new message headers arrive.

Use the references header to create the threads and the in-reply-to
header as a fall-back option in case no references header is present.

Does not run when the worker provides its own threading (e.g. imap
server threads).

Include only those message headers that have been fetched and are
stored in the message store.

References: https://www.jwz.org/doc/threading.html
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
Tested-by: akspecs <akspecs@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-02-24 13:00:12 +01:00