From cd3f995fe28d4b8e61137692672ebd3436f651f0 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 1 Mar 2018 16:56:10 +0100 Subject: Implemented examine --- examples/imapresource/imapserverproxy.cpp | 18 ++++++++++++++++++ examples/imapresource/imapserverproxy.h | 2 ++ 2 files changed, 20 insertions(+) (limited to 'examples') 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 ImapServerProxy::select(const Folder &folder) return select(mailboxFromFolder(folder)); } +KAsync::Job ImapServerProxy::examine(const QString &mailbox) +{ + auto select = new KIMAP2::SelectJob(mSession); + select->setOpenReadOnly(true); + select->setMailBox(mailbox); + select->setCondstoreEnabled(mCapabilities.contains(Capabilities::Condstore)); + return runJob(select, [select](KJob* job) -> SelectResult { + return {select->uidValidity(), select->nextUid(), select->highestModSequence()}; + }).onError([=] (const KAsync::Error &error) { + SinkWarning() << "Examine failed: " << mailbox; + }); +} + +KAsync::Job ImapServerProxy::examine(const Folder &folder) +{ + return examine(mailboxFromFolder(folder)); +} + KAsync::Job ImapServerProxy::append(const QString &mailbox, const QByteArray &content, const QList &flags, const QDateTime &internalDate) { 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: KAsync::Job logout(); KAsync::Job select(const QString &mailbox); KAsync::Job select(const Folder &mailbox); + KAsync::Job examine(const QString &mailbox); + KAsync::Job examine(const Folder &mailbox); KAsync::Job append(const QString &mailbox, const QByteArray &content, const QList &flags = QList(), const QDateTime &internalDate = QDateTime()); KAsync::Job store(const KIMAP2::ImapSet &set, const QList &flags); KAsync::Job storeFlags(const KIMAP2::ImapSet &set, const QList &flags); -- cgit v1.2.3