changeset 22914:3edf73ffeb2e

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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 17 Apr 2018 15:46:41 +0300
parents 70289891b91a
children 087aeff6bd2a
files src/lib-storage/index/imapc/imapc-mailbox.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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) {