diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-14 10:16:33 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-15 16:14:19 +0200 |
commit | 25fdab9836b1fdd248d3d36c00a96740093cd749 (patch) | |
tree | db9df043cadf90a7c27c43bab7217afda91db023 /examples/imapresource/imapresource.cpp | |
parent | 2bfccc6301f71db5bf45977bb2955c04fa6c1605 (diff) | |
download | sink-25fdab9836b1fdd248d3d36c00a96740093cd749.tar.gz sink-25fdab9836b1fdd248d3d36c00a96740093cd749.zip |
New kimap2 syntax
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r-- | examples/imapresource/imapresource.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 8422b49..c26dc39 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -220,10 +220,9 @@ public: | |||
220 | auto capabilities = imap->getCapabilities(); | 220 | auto capabilities = imap->getCapabilities(); |
221 | bool canDoIncrementalRemovals = false; | 221 | bool canDoIncrementalRemovals = false; |
222 | return KAsync::start<void>([=]() { | 222 | return KAsync::start<void>([=]() { |
223 | auto uidNext = syncStore().readValue(folder.normalizedPath().toUtf8() + "uidnext").toLongLong(); | ||
223 | const auto changedsince = syncStore().readValue(folder.normalizedPath().toUtf8() + "changedsince").toLongLong(); | 224 | const auto changedsince = syncStore().readValue(folder.normalizedPath().toUtf8() + "changedsince").toLongLong(); |
224 | // auto changedsince = QSharedPointer<qint64>::create(0); | 225 | return imap->fetchFlags(folder, KIMAP2::ImapSet(1, qMax(uidNext, qint64(1))), changedsince, [this, folder](const QVector<Message> &messages) { |
225 | //FIXME this should generate a compiletime error | ||
226 | return imap->fetchFlags(folder, changedsince, [this, folder](const QVector<Message> &messages) { | ||
227 | // synchronizeMails(folder.normalizedPath(), messages); | 226 | // synchronizeMails(folder.normalizedPath(), messages); |
228 | const auto folderLocalId = syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, folder.normalizedPath().toUtf8()); | 227 | const auto folderLocalId = syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, folder.normalizedPath().toUtf8()); |
229 | for (const auto &message : messages) { | 228 | for (const auto &message : messages) { |
@@ -266,11 +265,17 @@ public: | |||
266 | } | 265 | } |
267 | synchronizeMails(folder.normalizedPath(), messages); | 266 | synchronizeMails(folder.normalizedPath(), messages); |
268 | }, | 267 | }, |
269 | [](int progress, int total) { | 268 | [this, maxUid, folder](int progress, int total) { |
270 | SinkTrace() << "Progress: " << progress << " out of " << total; | 269 | SinkLog() << "Progress: " << progress << " out of " << total; |
270 | //commit every 10 messages | ||
271 | if ((progress % 10) == 0) { | ||
272 | commit(); | ||
273 | } | ||
271 | }) | 274 | }) |
272 | .syncThen<void>([this, maxUid, folder]() { | 275 | .syncThen<void>([this, maxUid, folder]() { |
273 | syncStore().writeValue(folder.normalizedPath().toUtf8() + "uidnext", QByteArray::number(*maxUid)); | 276 | syncStore().writeValue(folder.normalizedPath().toUtf8() + "uidnext", QByteArray::number(*maxUid)); |
277 | SinkLog() << "UIDMAX: " << *maxUid << folder.normalizedPath(); | ||
278 | commit(); | ||
274 | }); | 279 | }); |
275 | }); | 280 | }); |
276 | 281 | ||