dovecot: mail_index_lookup_seq*() were broken for updated transa...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 29 18:59:37 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/046d06f52aa6
changeset: 7064:046d06f52aa6
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 29 18:45:11 2007 +0200
description:
mail_index_lookup_seq*() were broken for updated transaction view when
trying to find messages past the first newly appended message.

diffstat:

1 file changed, 13 insertions(+), 2 deletions(-)
src/lib-index/mail-index-transaction-view.c |   15 +++++++++++++--

diffs (25 lines):

diff -r f9fa0f38cb0e -r 046d06f52aa6 src/lib-index/mail-index-transaction-view.c
--- a/src/lib-index/mail-index-transaction-view.c	Sat Dec 29 18:01:19 2007 +0200
+++ b/src/lib-index/mail-index-transaction-view.c	Sat Dec 29 18:45:11 2007 +0200
@@ -124,8 +124,19 @@ static void tview_lookup_seq_range(struc
 	}
 
 	/* at least some of the wanted messages are newly created */
-	if (*first_seq_r == 0)
-		*first_seq_r = tview->t->first_new_seq;
+	if (*first_seq_r == 0) {
+		seq = tview->t->first_new_seq;
+		for (; seq <= tview->t->last_new_seq; seq++) {
+			if (first_uid <= rec->uid)
+				break;
+			rec = mail_index_transaction_lookup(tview->t, seq);
+		}
+		if (seq > tview->t->last_new_seq) {
+			/* no messages in range */
+			return;
+		}
+		*first_seq_r = seq;
+	}
 
 	seq = tview->t->last_new_seq;
 	for (; seq >= tview->t->first_new_seq; seq--) {


More information about the dovecot-cvs mailing list