changeset 22765:ed02e59a449c

imapc: Fix imap_features=no-msn-updates to not fail on SELECT The initial EXISTS reply shouldn't be ignored, only the following ones.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 16 Jan 2018 18:17:00 +0200
parents 74dc3b764627
children 42c3dc36e8f9
files src/lib-storage/index/imapc/imapc-mailbox.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Mon Dec 25 11:10:19 2017 +0200
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Tue Jan 16 18:17:00 2018 +0200
@@ -274,8 +274,14 @@
 	uint32_t exists_count = reply->num;
 	const struct mail_index_header *hdr;
 
-	if (mbox == NULL || IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_NO_MSN_UPDATES))
+	if (mbox == NULL)
 		return;
+	if (mbox->exists_received &&
+	    IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_NO_MSN_UPDATES)) {
+		/* ignore all except the first EXISTS reply (returned by
+		   SELECT) */
+		return;
+	}
 
 	mbox->exists_count = exists_count;
 	mbox->exists_received = TRUE;