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.
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) {