Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6080:1f0e71c833c3 HEAD
Add missing records to mail index.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 18 Jul 2007 09:26:20 +0300 |
parents | d212e2b8c5a4 |
children | c23d396f84b2 |
files | src/lib-index/mailbox-list-index-sync.c |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 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 @@ 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; }