[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim-runtime/Applications/15.08] resources/imap: IMAP: use UIDNEXT instead of "*" as interval end
From:       Dan_Vrátil <dvratil () redhat ! com>
Date:       2015-10-03 12:45:24
Message-ID: E1ZiMBo-0003ct-S9 () scm ! kde ! org
[Download RAW message or body]

Git commit 813e4dfdcf30bed34397fa578d0d1ae0e61ea625 by Dan Vrátil.
Committed on 03/10/2015 at 12:37.
Pushed by dvratil into branch 'Applications/15.08'.

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

M  +2    -2    resources/imap/retrieveitemstask.cpp

http://commits.kde.org/kdepim-runtime/813e4dfdcf30bed34397fa578d0d1ae0e61ea625

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;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic