# HG changeset patch # User Timo Sirainen # Date 1453649968 -7200 # Node ID 9658506bb3aba0ce2e61af3066a0ed7bcfb96edd # Parent c1ba198e8b508bb2cae5e044279907832cab2652 imapc: Added imapc_features=fetch-msn-workarounds This can be used to work around broken servers that send invalid MSNs. This avoids errors like: imapc: Mailbox 'INBOX' state corrupted: FETCH UID mismatch (78976 != 82589) diff -r c1ba198e8b50 -r 9658506bb3ab src/lib-storage/index/imapc/imapc-mailbox.c --- a/src/lib-storage/index/imapc/imapc-mailbox.c Sun Jan 24 17:38:39 2016 +0200 +++ b/src/lib-storage/index/imapc/imapc-mailbox.c Sun Jan 24 17:39:28 2016 +0200 @@ -222,6 +222,16 @@ msgmap = imapc_client_mailbox_get_msgmap(mbox->client_box); msg_count = imapc_msgmap_count(msgmap); + if (fetch_uid != 0 && + IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_FETCH_MSN_WORKAROUNDS)) { + /* if we know the UID, use own own generated rseq instead of + the potentially broken rseq that the server sent. */ + uint32_t fixed_rseq; + + if (imapc_msgmap_uid_to_rseq(msgmap, fetch_uid, &fixed_rseq)) + rseq = fixed_rseq; + } + if (rseq <= msg_count) { uid = imapc_msgmap_rseq_to_uid(msgmap, rseq); if (uid != fetch_uid && fetch_uid != 0) { diff -r c1ba198e8b50 -r 9658506bb3ab src/lib-storage/index/imapc/imapc-settings.c --- a/src/lib-storage/index/imapc/imapc-settings.c Sun Jan 24 17:38:39 2016 +0200 +++ b/src/lib-storage/index/imapc/imapc-settings.c Sun Jan 24 17:39:28 2016 +0200 @@ -89,6 +89,7 @@ { "zimbra-workarounds", IMAPC_FEATURE_ZIMBRA_WORKAROUNDS }, { "no-examine", IMAPC_FEATURE_NO_EXAMINE }, { "proxyauth", IMAPC_FEATURE_PROXYAUTH }, + { "fetch-msn-workarounds", IMAPC_FEATURE_FETCH_MSN_WORKAROUNDS }, { NULL, 0 } }; diff -r c1ba198e8b50 -r 9658506bb3ab src/lib-storage/index/imapc/imapc-settings.h --- a/src/lib-storage/index/imapc/imapc-settings.h Sun Jan 24 17:38:39 2016 +0200 +++ b/src/lib-storage/index/imapc/imapc-settings.h Sun Jan 24 17:39:28 2016 +0200 @@ -12,7 +12,8 @@ IMAPC_FEATURE_SEARCH = 0x10, IMAPC_FEATURE_ZIMBRA_WORKAROUNDS = 0x20, IMAPC_FEATURE_NO_EXAMINE = 0x40, - IMAPC_FEATURE_PROXYAUTH = 0x80 + IMAPC_FEATURE_PROXYAUTH = 0x80, + IMAPC_FEATURE_FETCH_MSN_WORKAROUNDS = 0x100 }; /* */