dovecot-2.2: lib-index: Newly added messages weren't always sort...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jan 15 08:39:41 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/6139eac53d72
changeset: 15647:6139eac53d72
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jan 15 08:39:30 2013 +0200
description:
lib-index: Newly added messages weren't always sorted by UIDs.

diffstat:

 src/lib-index/mail-index-transaction-update.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 0e12a687f5bf -r 6139eac53d72 src/lib-index/mail-index-transaction-update.c
--- a/src/lib-index/mail-index-transaction-update.c	Tue Jan 15 08:30:57 2013 +0200
+++ b/src/lib-index/mail-index-transaction-update.c	Tue Jan 15 08:39:30 2013 +0200
@@ -201,6 +201,7 @@
 	unsigned int i, count;
 	struct seq_range *range;
 	uint32_t next_uid;
+	bool used_existing_uids;
 	
 	if (!array_is_created(&t->appends))
 		return;
@@ -216,9 +217,15 @@
 	}
 
 	/* assign missing uids */
+	used_existing_uids = FALSE;
 	for (i = 0; i < count; i++) {
-		if (recs[i].uid == 0 || recs[i].uid < first_uid)
+		if (recs[i].uid == 0 || recs[i].uid < first_uid) {
 			recs[i].uid = next_uid++;
+			if (used_existing_uids)
+				t->appends_nonsorted = TRUE;
+		} else {
+			used_existing_uids = TRUE;
+		}
 	}
 
 	/* write the saved uids range */


More information about the dovecot-cvs mailing list