diff options
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r-- | examples/imapresource/imapresource.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index aad7887..3a7be2d 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -219,8 +219,23 @@ public: | |||
219 | SinkLog() << "Synchronizing mails" << folder.normalizedPath(); | 219 | SinkLog() << "Synchronizing mails" << folder.normalizedPath(); |
220 | auto capabilities = imap->getCapabilities(); | 220 | auto capabilities = imap->getCapabilities(); |
221 | bool canDoIncrementalRemovals = false; | 221 | bool canDoIncrementalRemovals = false; |
222 | return KAsync::syncStart<void>([=]() { | 222 | return KAsync::start<void>([=]() { |
223 | //TODO update flags | 223 | const auto changedsince = syncStore().readValue(folder.normalizedPath().toUtf8() + "changedsince").toLongLong(); |
224 | // auto changedsince = QSharedPointer<qint64>::create(0); | ||
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); | ||
228 | const auto folderLocalId = syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, folder.normalizedPath().toUtf8()); | ||
229 | for (const auto &message : messages) { | ||
230 | const auto remoteId = assembleMailRid(folderLocalId, message.uid); | ||
231 | |||
232 | |||
233 | auto mail = Sink::ApplicationDomain::Mail::create(mResourceInstanceIdentifier); | ||
234 | mail.setUnread(!message.flags.contains(Imap::Flags::Seen)); | ||
235 | mail.setImportant(message.flags.contains(Imap::Flags::Flagged)); | ||
236 | createOrModify(ENTITY_TYPE_MAIL, remoteId, mail); | ||
237 | } | ||
238 | }); | ||
224 | }) | 239 | }) |
225 | .then<void>([=]() { | 240 | .then<void>([=]() { |
226 | //TODO Remove what's no longer existing | 241 | //TODO Remove what's no longer existing |