From 3fa1766af3fa85067d4b2d48c8410e6c201ae323 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 12 Jun 2016 02:11:02 +0200 Subject: Moving of mails between folders --- examples/imapresource/imapresource.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'examples/imapresource/imapresource.cpp') diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index aca1c01..8cbb9fa 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp @@ -491,8 +491,11 @@ public: flags << Imap::Flags::Flagged; } - const bool messageChanged = changedProperties.contains(Sink::ApplicationDomain::Mail::MimeMessage::name); - if (messageChanged) { + const bool messageMoved = changedProperties.contains(ApplicationDomain::Mail::Folder::name); + const bool messageChanged = changedProperties.contains(ApplicationDomain::Mail::MimeMessage::name); + if (messageChanged || messageMoved) { + const auto folderId = folderIdFromMailRid(oldRemoteId); + const QString oldMailbox = syncStore().resolveLocalId(ENTITY_TYPE_FOLDER, folderId); QByteArray content = KMime::LFtoCRLF(mail.getMimeMessage()); QDateTime internalDate = mail.getDate(); auto rid = QSharedPointer::create(); @@ -504,7 +507,7 @@ public: Trace() << "Finished creating a modified mail: " << remoteId; *rid = remoteId; }) - .then(imap->remove(mailbox, set)) + .then(imap->remove(oldMailbox, set)) .then([rid, imap]() { return *rid; }); -- cgit v1.2.3