Mercurial > dovecot > core-2.2
changeset 15647:6139eac53d72
lib-index: Newly added messages weren't always sorted by UIDs.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 15 Jan 2013 08:39:30 +0200 |
parents | 0e12a687f5bf |
children | 5eedc2b9cb23 |
files | src/lib-index/mail-index-transaction-update.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 */