summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2015-10-03 12:37:34 (GMT)
committerDan Vrátil <dvratil@redhat.com>2015-10-03 12:37:36 (GMT)
commit813e4dfdcf30bed34397fa578d0d1ae0e61ea625 (patch)
tree638755822bbb7229f8fa82904521dd7c82114f99
parentf50c347397684fc6acb1253b9190a10508816c22 (diff)
IMAP: use UIDNEXT instead of "*" as interval end when doing full mailbox resync
The opened interval is represented as -1, so when syncing with Microsoft Exchange the qMin() comparision in the search-in-chunks workaround for Exchange evaluates as qMin(X, 2^32-1), causing the BatcherFetcher to get to a loop trying to SEARCH all chunks between 1 and 2^32-1. In practice Exchange will drop connection at some point, so the folder sync is aborted and no emails are ever synced. With this patch we limit the interval end to reported UIDNEXT, so that the SEARCH loop is finished when we reach the interval with UIDNEXT. BUG: 351814 FIXED-IN: 15.08.2
-rw-r--r--resources/imap/retrieveitemstask.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/resources/imap/retrieveitemstask.cpp b/resources/imap/retrieveitemstask.cpp
index 91b287c..a75ed26 100644
--- a/resources/imap/retrieveitemstask.cpp
+++ b/resources/imap/retrieveitemstask.cpp
@@ -387,7 +387,7 @@ void RetrieveItemsTask::onFinalSelectDone(KJob *job)
}
qCDebug(IMAPRESOURCE_LOG) << "Fetching complete mailbox " << mailBox;
setTotalItems(messageCount);
- retrieveItems(KIMAP::ImapSet(1, 0), scope, false, true);
+ retrieveItems(KIMAP::ImapSet(1, nextUid), scope, false, true);
} else if (nextUid <= 0) {
//This is a compatibilty codepath for Courier IMAP. It probably introduces problems, but at least it syncs.
//Since we don't have uidnext available, we simply use the messagecount. This will miss simultaneously added/removed messages.
@@ -430,7 +430,7 @@ void RetrieveItemsTask::onFinalSelectDone(KJob *job)
qCWarning(IMAPRESOURCE_LOG) << "Detected inconsistency in local cache, we're missing some messages. Server: " << messageCount << " Local: " << realMessageCount;
qCWarning(IMAPRESOURCE_LOG) << "Refetching complete mailbox.";
setTotalItems(messageCount);
- retrieveItems(KIMAP::ImapSet(1, 0), scope, false, true);
+ retrieveItems(KIMAP::ImapSet(1, nextUid), scope, false, true);
} else if (nextUid > oldNextUid) {
//New messages are available. Fetch new messages, and then check for changed flags and removed messages
qCDebug(IMAPRESOURCE_LOG) << "Fetching new messages: UidNext: " << nextUid << " Old UidNext: " << oldNextUid;