diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-22 15:27:52 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-22 15:27:52 +0200 |
commit | f38554ad4c7ff918bf7792413e6599e69d30cf3a (patch) | |
tree | 8f971c3c5349166e6f2b488c7983bc868627e524 /examples/imapresource/imapserverproxy.h | |
parent | 1613964dd195a21eb7ff28699b76db8d41fb8408 (diff) | |
download | sink-f38554ad4c7ff918bf7792413e6599e69d30cf3a.tar.gz sink-f38554ad4c7ff918bf7792413e6599e69d30cf3a.zip |
Support for folder hierarchies
Diffstat (limited to 'examples/imapresource/imapserverproxy.h')
-rw-r--r-- | examples/imapresource/imapserverproxy.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/examples/imapresource/imapserverproxy.h b/examples/imapresource/imapserverproxy.h index 2beb28c..475a45d 100644 --- a/examples/imapresource/imapserverproxy.h +++ b/examples/imapresource/imapserverproxy.h | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <KIMAP/KIMAP/Session> | 26 | #include <KIMAP/KIMAP/Session> |
27 | #include <KIMAP/KIMAP/FetchJob> | 27 | #include <KIMAP/KIMAP/FetchJob> |
28 | 28 | ||
29 | namespace Imap { | ||
30 | |||
29 | struct Message { | 31 | struct Message { |
30 | qint64 uid; | 32 | qint64 uid; |
31 | qint64 size; | 33 | qint64 size; |
@@ -34,6 +36,10 @@ struct Message { | |||
34 | KMime::Message::Ptr msg; | 36 | KMime::Message::Ptr msg; |
35 | }; | 37 | }; |
36 | 38 | ||
39 | struct Folder { | ||
40 | QList<QString> pathParts; | ||
41 | }; | ||
42 | |||
37 | class ImapServerProxy { | 43 | class ImapServerProxy { |
38 | KIMAP::Session *mSession; | 44 | KIMAP::Session *mSession; |
39 | public: | 45 | public: |
@@ -43,6 +49,7 @@ public: | |||
43 | KAsync::Job<void> login(const QString &username, const QString &password); | 49 | KAsync::Job<void> login(const QString &username, const QString &password); |
44 | KAsync::Job<void> select(const QString &mailbox); | 50 | KAsync::Job<void> select(const QString &mailbox); |
45 | KAsync::Job<void> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime()); | 51 | KAsync::Job<void> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime()); |
52 | KAsync::Job<void> create(const QString &mailbox); | ||
46 | 53 | ||
47 | typedef std::function<void(const QString &, | 54 | typedef std::function<void(const QString &, |
48 | const QMap<qint64,qint64> &, | 55 | const QMap<qint64,qint64> &, |
@@ -57,6 +64,8 @@ public: | |||
57 | //Composed calls that do login etc. | 64 | //Composed calls that do login etc. |
58 | KAsync::Job<QList<qint64>> fetchHeaders(const QString &mailbox); | 65 | KAsync::Job<QList<qint64>> fetchHeaders(const QString &mailbox); |
59 | 66 | ||
60 | KAsync::Future<void> fetchFolders(std::function<void(const QStringList &)> callback); | 67 | KAsync::Future<void> fetchFolders(std::function<void(const QVector<Folder> &)> callback); |
61 | KAsync::Future<void> fetchMessages(const QString &folder, std::function<void(const QVector<Message> &)> callback); | 68 | KAsync::Future<void> fetchMessages(const Folder &folder, std::function<void(const QVector<Message> &)> callback); |
62 | }; | 69 | }; |
70 | |||
71 | } | ||