summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-01 16:56:10 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-01 16:56:10 +0100
commitcd3f995fe28d4b8e61137692672ebd3436f651f0 (patch)
tree7286a036e281113ca880cac2c17da13847e6fee2
parente39eba2ee20f04dbbd9656ba362ac27aabdd376a (diff)
downloadsink-cd3f995fe28d4b8e61137692672ebd3436f651f0.tar.gz
sink-cd3f995fe28d4b8e61137692672ebd3436f651f0.zip
Implemented examine
-rw-r--r--examples/imapresource/imapserverproxy.cpp18
-rw-r--r--examples/imapresource/imapserverproxy.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp
index a5a64db..08001d9 100644
--- a/examples/imapresource/imapserverproxy.cpp
+++ b/examples/imapresource/imapserverproxy.cpp
@@ -249,6 +249,24 @@ KAsync::Job<SelectResult> ImapServerProxy::select(const Folder &folder)
249 return select(mailboxFromFolder(folder)); 249 return select(mailboxFromFolder(folder));
250} 250}
251 251
252KAsync::Job<SelectResult> ImapServerProxy::examine(const QString &mailbox)
253{
254 auto select = new KIMAP2::SelectJob(mSession);
255 select->setOpenReadOnly(true);
256 select->setMailBox(mailbox);
257 select->setCondstoreEnabled(mCapabilities.contains(Capabilities::Condstore));
258 return runJob<SelectResult>(select, [select](KJob* job) -> SelectResult {
259 return {select->uidValidity(), select->nextUid(), select->highestModSequence()};
260 }).onError([=] (const KAsync::Error &error) {
261 SinkWarning() << "Examine failed: " << mailbox;
262 });
263}
264
265KAsync::Job<SelectResult> ImapServerProxy::examine(const Folder &folder)
266{
267 return examine(mailboxFromFolder(folder));
268}
269
252KAsync::Job<qint64> ImapServerProxy::append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags, const QDateTime &internalDate) 270KAsync::Job<qint64> ImapServerProxy::append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags, const QDateTime &internalDate)
253{ 271{
254 auto append = new KIMAP2::AppendJob(mSession); 272 auto append = new KIMAP2::AppendJob(mSession);
diff --git a/examples/imapresource/imapserverproxy.h b/examples/imapresource/imapserverproxy.h
index c69fe67..013c18f 100644
--- a/examples/imapresource/imapserverproxy.h
+++ b/examples/imapresource/imapserverproxy.h
@@ -262,6 +262,8 @@ public:
262 KAsync::Job<void> logout(); 262 KAsync::Job<void> logout();
263 KAsync::Job<SelectResult> select(const QString &mailbox); 263 KAsync::Job<SelectResult> select(const QString &mailbox);
264 KAsync::Job<SelectResult> select(const Folder &mailbox); 264 KAsync::Job<SelectResult> select(const Folder &mailbox);
265 KAsync::Job<SelectResult> examine(const QString &mailbox);
266 KAsync::Job<SelectResult> examine(const Folder &mailbox);
265 KAsync::Job<qint64> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime()); 267 KAsync::Job<qint64> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime());
266 KAsync::Job<void> store(const KIMAP2::ImapSet &set, const QList<QByteArray> &flags); 268 KAsync::Job<void> store(const KIMAP2::ImapSet &set, const QList<QByteArray> &flags);
267 KAsync::Job<void> storeFlags(const KIMAP2::ImapSet &set, const QList<QByteArray> &flags); 269 KAsync::Job<void> storeFlags(const KIMAP2::ImapSet &set, const QList<QByteArray> &flags);