summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-10 20:44:08 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-10 20:44:08 +0100
commit051a0be95cbe4fe5eb0c7431e13987a2aa56bcc0 (patch)
tree14b8400e9012da5aecfae67653e187b090bfb51c /examples
parent1aefcdb05bbf39d510235ba05095b35ada1ed5cb (diff)
downloadsink-051a0be95cbe4fe5eb0c7431e13987a2aa56bcc0.tar.gz
sink-051a0be95cbe4fe5eb0c7431e13987a2aa56bcc0.zip
Logout after synchronization
Diffstat (limited to 'examples')
-rw-r--r--examples/imapresource/imapresource.cpp14
-rw-r--r--examples/imapresource/imapserverproxy.cpp7
-rw-r--r--examples/imapresource/imapserverproxy.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp
index be8ade5..4f7b9f3 100644
--- a/examples/imapresource/imapresource.cpp
+++ b/examples/imapresource/imapresource.cpp
@@ -449,6 +449,13 @@ public:
449 commit(); 449 commit();
450 return *folderList; 450 return *folderList;
451 }); 451 });
452 })
453 .then<void>([=] (const KAsync::Error &error) {
454 if (error) {
455 SinkWarning() << "Error during sync: " << error.errorMessage;
456 }
457 return imap->logout()
458 .then(KAsync::error(error));
452 }); 459 });
453 } else if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { 460 } else if (query.type() == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) {
454 //TODO 461 //TODO
@@ -513,6 +520,13 @@ public:
513 }); 520 });
514 }); 521 });
515 } 522 }
523 })
524 .then<void>([=] (const KAsync::Error &error) {
525 if (error) {
526 SinkWarning() << "Error during sync: " << error.errorMessage;
527 }
528 return imap->logout()
529 .then(KAsync::error(error));
516 }); 530 });
517 } 531 }
518 return KAsync::error<void>("Nothing to do"); 532 return KAsync::error<void>("Nothing to do");
diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp
index dd1be69..6f8d18b 100644
--- a/examples/imapresource/imapserverproxy.cpp
+++ b/examples/imapresource/imapserverproxy.cpp
@@ -23,6 +23,7 @@
23#include <QTcpSocket> 23#include <QTcpSocket>
24#include <QTimer> 24#include <QTimer>
25#include <KIMAP2/LoginJob> 25#include <KIMAP2/LoginJob>
26#include <KIMAP2/LogoutJob>
26#include <KIMAP2/NamespaceJob> 27#include <KIMAP2/NamespaceJob>
27#include <KIMAP2/SelectJob> 28#include <KIMAP2/SelectJob>
28#include <KIMAP2/AppendJob> 29#include <KIMAP2/AppendJob>
@@ -150,6 +151,12 @@ KAsync::Job<void> ImapServerProxy::login(const QString &username, const QString
150 }); 151 });
151} 152}
152 153
154KAsync::Job<void> ImapServerProxy::logout()
155{
156 auto logoutJob = new KIMAP2::LogoutJob(mSession);
157 return runJob(logoutJob);
158}
159
153KAsync::Job<SelectResult> ImapServerProxy::select(const QString &mailbox) 160KAsync::Job<SelectResult> ImapServerProxy::select(const QString &mailbox)
154{ 161{
155 auto select = new KIMAP2::SelectJob(mSession); 162 auto select = new KIMAP2::SelectJob(mSession);
diff --git a/examples/imapresource/imapserverproxy.h b/examples/imapresource/imapserverproxy.h
index d99459f..5244cdc 100644
--- a/examples/imapresource/imapserverproxy.h
+++ b/examples/imapresource/imapserverproxy.h
@@ -123,6 +123,7 @@ public:
123 123
124 //Standard IMAP calls 124 //Standard IMAP calls
125 KAsync::Job<void> login(const QString &username, const QString &password); 125 KAsync::Job<void> login(const QString &username, const QString &password);
126 KAsync::Job<void> logout();
126 KAsync::Job<SelectResult> select(const QString &mailbox); 127 KAsync::Job<SelectResult> select(const QString &mailbox);
127 KAsync::Job<qint64> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime()); 128 KAsync::Job<qint64> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime());
128 KAsync::Job<void> store(const KIMAP2::ImapSet &set, const QList<QByteArray> &flags); 129 KAsync::Job<void> store(const KIMAP2::ImapSet &set, const QList<QByteArray> &flags);