diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-12 02:11:02 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-12 02:11:02 +0200 |
commit | 3fa1766af3fa85067d4b2d48c8410e6c201ae323 (patch) | |
tree | 5662b068088472ad7133d2b91bb0e0ffe1d9b10c /examples/imapresource/imapserverproxy.cpp | |
parent | ce56e7e0c973d31a900c9c467f639a344ea71bf1 (diff) | |
download | sink-3fa1766af3fa85067d4b2d48c8410e6c201ae323.tar.gz sink-3fa1766af3fa85067d4b2d48c8410e6c201ae323.zip |
Moving of mails between folders
Diffstat (limited to 'examples/imapresource/imapserverproxy.cpp')
-rw-r--r-- | examples/imapresource/imapserverproxy.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp index db68a53..49711a9 100644 --- a/examples/imapresource/imapserverproxy.cpp +++ b/examples/imapresource/imapserverproxy.cpp | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <KIMAP/KIMAP/SelectJob> | 25 | #include <KIMAP/KIMAP/SelectJob> |
26 | #include <KIMAP/KIMAP/AppendJob> | 26 | #include <KIMAP/KIMAP/AppendJob> |
27 | #include <KIMAP/KIMAP/CreateJob> | 27 | #include <KIMAP/KIMAP/CreateJob> |
28 | #include <KIMAP/KIMAP/CopyJob> | ||
28 | #include <KIMAP/KIMAP/RenameJob> | 29 | #include <KIMAP/KIMAP/RenameJob> |
29 | #include <KIMAP/KIMAP/DeleteJob> | 30 | #include <KIMAP/KIMAP/DeleteJob> |
30 | #include <KIMAP/KIMAP/StoreJob> | 31 | #include <KIMAP/KIMAP/StoreJob> |
@@ -219,6 +220,15 @@ KAsync::Job<void> ImapServerProxy::expunge(const KIMAP::ImapSet &set) | |||
219 | return runJob(job); | 220 | return runJob(job); |
220 | } | 221 | } |
221 | 222 | ||
223 | KAsync::Job<void> ImapServerProxy::copy(const KIMAP::ImapSet &set, const QString &newMailbox) | ||
224 | { | ||
225 | auto copy = new KIMAP::CopyJob(mSession); | ||
226 | copy->setSequenceSet(set); | ||
227 | copy->setUidBased(true); | ||
228 | copy->setMailBox(newMailbox); | ||
229 | return runJob(copy); | ||
230 | } | ||
231 | |||
222 | KAsync::Job<void> ImapServerProxy::fetch(const KIMAP::ImapSet &set, KIMAP::FetchJob::FetchScope scope, FetchCallback callback) | 232 | KAsync::Job<void> ImapServerProxy::fetch(const KIMAP::ImapSet &set, KIMAP::FetchJob::FetchScope scope, FetchCallback callback) |
223 | { | 233 | { |
224 | auto fetch = new KIMAP::FetchJob(mSession); | 234 | auto fetch = new KIMAP::FetchJob(mSession); |
@@ -304,6 +314,12 @@ KAsync::Job<void> ImapServerProxy::remove(const QString &mailbox, const QByteArr | |||
304 | return remove(mailbox, set); | 314 | return remove(mailbox, set); |
305 | } | 315 | } |
306 | 316 | ||
317 | |||
318 | KAsync::Job<void> ImapServerProxy::move(const QString &mailbox, const KIMAP::ImapSet &set, const QString &newMailbox) | ||
319 | { | ||
320 | return select(mailbox).then<void>(copy(set, newMailbox)).then<void>(store(set, QByteArrayList() << Flags::Deleted)).then<void>(expunge(set)); | ||
321 | } | ||
322 | |||
307 | KAsync::Job<QString> ImapServerProxy::createSubfolder(const QString &parentMailbox, const QString &folderName) | 323 | KAsync::Job<QString> ImapServerProxy::createSubfolder(const QString &parentMailbox, const QString &folderName) |
308 | { | 324 | { |
309 | auto folder = QSharedPointer<QString>::create(); | 325 | auto folder = QSharedPointer<QString>::create(); |