diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-08-31 14:02:42 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-15 16:14:19 +0200 |
commit | 2bfccc6301f71db5bf45977bb2955c04fa6c1605 (patch) | |
tree | 688fb47df6f880e9287c319cde943f0286fe295b /examples/imapresource/imapserverproxy.cpp | |
parent | 3d8802e235e9508a0bf3d8a1168ad11c95571579 (diff) | |
download | sink-2bfccc6301f71db5bf45977bb2955c04fa6c1605.tar.gz sink-2bfccc6301f71db5bf45977bb2955c04fa6c1605.zip |
Remember highestmodseq
Diffstat (limited to 'examples/imapresource/imapserverproxy.cpp')
-rw-r--r-- | examples/imapresource/imapserverproxy.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp index 4ce413a..0f3524f 100644 --- a/examples/imapresource/imapserverproxy.cpp +++ b/examples/imapresource/imapserverproxy.cpp | |||
@@ -100,7 +100,7 @@ ImapServerProxy::ImapServerProxy(const QString &serverUrl, int port) : mSession( | |||
100 | if (Sink::Test::testModeEnabled()) { | 100 | if (Sink::Test::testModeEnabled()) { |
101 | mSession->setTimeout(1); | 101 | mSession->setTimeout(1); |
102 | } else { | 102 | } else { |
103 | mSession->setTimeout(10); | 103 | mSession->setTimeout(20); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
@@ -416,15 +416,15 @@ QString ImapServerProxy::mailboxFromFolder(const Folder &folder) const | |||
416 | return folder.pathParts.join(mPersonalNamespaceSeparator); | 416 | return folder.pathParts.join(mPersonalNamespaceSeparator); |
417 | } | 417 | } |
418 | 418 | ||
419 | KAsync::Job<void> ImapServerProxy::fetchFlags(const Folder &folder, qint64 changedsince, std::function<void(const QVector<Message> &)> callback) | 419 | KAsync::Job<SelectResult> ImapServerProxy::fetchFlags(const Folder &folder, qint64 changedsince, std::function<void(const QVector<Message> &)> callback) |
420 | { | 420 | { |
421 | SinkTrace() << "Fetching flags " << folder.normalizedPath(); | 421 | SinkTrace() << "Fetching flags " << folder.normalizedPath(); |
422 | return select(mailboxFromFolder(folder)).then<void, SelectResult>([=](const SelectResult &selectResult) -> KAsync::Job<void> { | 422 | return select(mailboxFromFolder(folder)).then<SelectResult, SelectResult>([=](const SelectResult &selectResult) -> KAsync::Job<SelectResult> { |
423 | SinkTrace() << "Modeseq " << folder.normalizedPath() << selectResult.highestModSequence << changedsince; | 423 | SinkTrace() << "Modeseq " << folder.normalizedPath() << selectResult.highestModSequence << changedsince; |
424 | 424 | ||
425 | if (selectResult.highestModSequence == static_cast<quint64>(changedsince)) { | 425 | if (selectResult.highestModSequence == static_cast<quint64>(changedsince)) { |
426 | SinkTrace()<< folder.normalizedPath() << "Changedsince didn't change, nothing to do."; | 426 | SinkTrace()<< folder.normalizedPath() << "Changedsince didn't change, nothing to do."; |
427 | return KAsync::null<void>(); | 427 | return KAsync::value<SelectResult>(selectResult); |
428 | } | 428 | } |
429 | 429 | ||
430 | SinkTrace() << "Fetching flags " << folder.normalizedPath() << selectResult.highestModSequence << changedsince; | 430 | SinkTrace() << "Fetching flags " << folder.normalizedPath() << selectResult.highestModSequence << changedsince; |
@@ -433,7 +433,9 @@ KAsync::Job<void> ImapServerProxy::fetchFlags(const Folder &folder, qint64 chang | |||
433 | scope.mode = KIMAP2::FetchJob::FetchScope::Flags; | 433 | scope.mode = KIMAP2::FetchJob::FetchScope::Flags; |
434 | scope.changedSince = changedsince; | 434 | scope.changedSince = changedsince; |
435 | 435 | ||
436 | return fetch(KIMAP2::ImapSet(1, 0), scope, callback); | 436 | return fetch(KIMAP2::ImapSet(1, 0), scope, callback).syncThen<SelectResult>([selectResult] { |
437 | return selectResult; | ||
438 | }); | ||
437 | }); | 439 | }); |
438 | } | 440 | } |
439 | 441 | ||
@@ -443,7 +445,6 @@ KAsync::Job<void> ImapServerProxy::fetchMessages(const Folder &folder, qint64 ui | |||
443 | time->start(); | 445 | time->start(); |
444 | Q_ASSERT(!mPersonalNamespaceSeparator.isNull()); | 446 | Q_ASSERT(!mPersonalNamespaceSeparator.isNull()); |
445 | return select(mailboxFromFolder(folder)).then<void, SelectResult>([this, callback, folder, time, progress, uidNext](const SelectResult &selectResult) -> KAsync::Job<void> { | 447 | return select(mailboxFromFolder(folder)).then<void, SelectResult>([this, callback, folder, time, progress, uidNext](const SelectResult &selectResult) -> KAsync::Job<void> { |
446 | |||
447 | SinkTrace() << "UIDNEXT " << folder.normalizedPath() << selectResult.uidNext << uidNext; | 448 | SinkTrace() << "UIDNEXT " << folder.normalizedPath() << selectResult.uidNext << uidNext; |
448 | if (selectResult.uidNext == (uidNext + 1)) { | 449 | if (selectResult.uidNext == (uidNext + 1)) { |
449 | SinkTrace()<< folder.normalizedPath() << "Uidnext didn't change, nothing to do."; | 450 | SinkTrace()<< folder.normalizedPath() << "Uidnext didn't change, nothing to do."; |