Skip to content

Commit

Permalink
imapc: Fix expunges+appends in same session with imapc_features=no-ms…
Browse files Browse the repository at this point in the history
…n-updates

Since the EXPUNGEs were ignored, the sequence numbers weren't updated.
When a new mail arrived, the sequence number sent by the remote IMAP server
pointed to existing mails in imapc's mapping. Fix this by changing the
sequence number if the returned UID is >= next_uid.

Fixes "FETCH UID mismatch" errors.
  • Loading branch information
sirainen committed Apr 17, 2018
1 parent 5d02c01 commit 381d900
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -372,6 +372,14 @@ imapc_mailbox_msgmap_update(struct imapc_mailbox *mbox,

if (imapc_msgmap_uid_to_rseq(msgmap, fetch_uid, &fixed_rseq))
rseq = fixed_rseq;
else if (fetch_uid >= imapc_msgmap_uidnext(msgmap) &&
rseq <= msg_count) {
/* The current rseq is wrong. Lets hope that the
correct rseq is the next new one. This happens
especially with no-msn-updates when mails have been
expunged and new mails arrive in the same session. */
rseq = msg_count+1;
}
}

if (rseq <= msg_count) {
Expand Down

0 comments on commit 381d900

Please sign in to comment.