dovecot-1.0: THREAD fixes: If sent date isn't usable, fallback t...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 8 05:48:02 EET 2008


details:   http://hg.dovecot.org/dovecot-1.0/rev/3dd130ce8e29
changeset: 5534:3dd130ce8e29
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 08 05:47:59 2008 +0200
description:
THREAD fixes: If sent date isn't usable, fallback to received date. If
thread building would introduce loop, the message should not have a parent
then.

diffstat:

1 file changed, 8 insertions(+), 3 deletions(-)
src/imap/imap-thread.c |   11 ++++++++---

diffs (32 lines):

diff -r e07e8f651ec8 -r 3dd130ce8e29 src/imap/imap-thread.c
--- a/src/imap/imap-thread.c	Thu Mar 06 02:08:41 2008 +0200
+++ b/src/imap/imap-thread.c	Sat Mar 08 05:47:59 2008 +0200
@@ -389,13 +389,13 @@ static void link_node(struct thread_cont
 		return;
 	}
 
+	if (child->parent != NULL)
+		unlink_child(ctx, child, FALSE);
+
 	if (find_parent(parent, child)) {
 		/* this would create a loop, not allowed */
 		return;
 	}
-
-	if (child->parent != NULL)
-		unlink_child(ctx, child, FALSE);
 
 	/* link them */
 	child->parent = parent;
@@ -449,6 +449,11 @@ static void mail_thread_input(struct thr
 	sent_date = mail_get_date(mail, NULL);
 	if (sent_date == (time_t)-1)
 		sent_date = 0;
+	if (sent_date == 0) {
+		sent_date = mail_get_received_date(mail);
+		if (sent_date == (time_t)-1)
+			sent_date = 0;
+	}
 
 	message_id = mail_get_first_header(mail, "message-id");
 	node = update_message(ctx, get_msgid(&message_id), sent_date,


More information about the dovecot-cvs mailing list