Skip to content

Commit

Permalink
imapc: Fix errors when handling UIDVALIDITY change
Browse files Browse the repository at this point in the history
This mainly happened when imapc was used with index files and the backend
IMAP server recreated the mailbox. This caused errors like:
Expunged message uid=1 reappeared - reconnecting
  • Loading branch information
sirainen authored and villesavolainen committed Apr 16, 2018
1 parent 463362a commit 12c4e52
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -733,6 +733,12 @@ static void imapc_sync_uid_validity(struct imapc_mailbox *mbox)
/* uidvalidity changed, reset the entire mailbox */
mail_index_reset(mbox->delayed_sync_trans);
mbox->sync_fetch_first_uid = 1;
/* The reset needs to be committed before FETCH 1:*
results are received. */
bool changes;
if (imapc_mailbox_commit_delayed_trans(mbox, &changes) < 0)
mail_index_mark_corrupted(mbox->box.index);
imapc_mailbox_init_delayed_trans(mbox);
}
mail_index_update_header(mbox->delayed_sync_trans,
offsetof(struct mail_index_header, uid_validity),
Expand Down

0 comments on commit 12c4e52

Please sign in to comment.