dovecot: Add missing records to mail index.

dovecot at dovecot.org dovecot at dovecot.org
Wed Jul 18 09:26:41 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/1f0e71c833c3
changeset: 6080:1f0e71c833c3
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jul 18 09:26:20 2007 +0300
description:
Add missing records to mail index.

diffstat:

1 file changed, 11 insertions(+), 4 deletions(-)
src/lib-index/mailbox-list-index-sync.c |   15 +++++++++++----

diffs (32 lines):

diff -r d212e2b8c5a4 -r 1f0e71c833c3 src/lib-index/mailbox-list-index-sync.c
--- a/src/lib-index/mailbox-list-index-sync.c	Wed Jul 18 09:09:00 2007 +0300
+++ b/src/lib-index/mailbox-list-index-sync.c	Wed Jul 18 09:26:20 2007 +0300
@@ -195,6 +195,8 @@ mailbox_list_index_sync_get_seq(struct m
 mailbox_list_index_sync_get_seq(struct mailbox_list_index_sync_ctx *ctx,
 				struct mailbox_list_sync_record *rec)
 {
+	const struct mail_index_header *mail_hdr;
+
 	if (rec->uid == 0) {
 		return mailbox_list_index_set_corrupted(ctx->index,
 							"Record with UID=0");
@@ -204,10 +206,15 @@ mailbox_list_index_sync_get_seq(struct m
 		return -1;
 
 	if (rec->seq == 0) {
-		i_warning("%s: Desync: Record uid=%u expunged from mail index",
-			  ctx->index->mail_index->filepath, rec->uid);
-		ctx->restart = TRUE;
-		return -1;
+		mail_hdr = mail_index_get_header(ctx->mail_view);
+		if (rec->uid < mail_hdr->next_uid) {
+			i_warning("%s: Desync: Record uid=%u "
+				  "expunged from mail index",
+				  ctx->index->mail_index->filepath, rec->uid);
+			ctx->restart = TRUE;
+			return -1;
+		}
+		mail_index_append(ctx->trans, rec->uid, &rec->seq);
 	}
 	return 0;
 }


More information about the dovecot-cvs mailing list