# HG changeset patch # User Timo Sirainen # Date 1523969201 -10800 # Node ID 3edf73ffeb2e14140007b7ae095d33d000452ac7 # Parent 70289891b91a78e4c6e3d3a493348406d56a615b imapc: Fix expunges+appends in same session with imapc_features=no-msn-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. diff -r 70289891b91a -r 3edf73ffeb2e src/lib-storage/index/imapc/imapc-mailbox.c --- a/src/lib-storage/index/imapc/imapc-mailbox.c Fri Apr 13 13:33:56 2018 +0300 +++ b/src/lib-storage/index/imapc/imapc-mailbox.c Tue Apr 17 15:46:41 2018 +0300 @@ -372,6 +372,14 @@ 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) {