diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-23 13:55:36 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-23 13:55:36 +0200 |
commit | a853cb1a32ae9207501fc4378357107013ebce21 (patch) | |
tree | 982b30db053dc03921a5c7e55ee3f097e2d8c439 /examples/imapresource/imapserverproxy.h | |
parent | f38554ad4c7ff918bf7792413e6599e69d30cf3a (diff) | |
download | sink-a853cb1a32ae9207501fc4378357107013ebce21.tar.gz sink-a853cb1a32ae9207501fc4378357107013ebce21.zip |
Message removals
Diffstat (limited to 'examples/imapresource/imapserverproxy.h')
-rw-r--r-- | examples/imapresource/imapserverproxy.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/imapresource/imapserverproxy.h b/examples/imapresource/imapserverproxy.h index 475a45d..7000c67 100644 --- a/examples/imapresource/imapserverproxy.h +++ b/examples/imapresource/imapserverproxy.h | |||
@@ -28,6 +28,18 @@ | |||
28 | 28 | ||
29 | namespace Imap { | 29 | namespace Imap { |
30 | 30 | ||
31 | namespace Flags | ||
32 | { | ||
33 | /// The flag for a message being seen (i.e. opened by user). | ||
34 | extern const char* Seen; | ||
35 | /// The flag for a message being deleted by the user. | ||
36 | extern const char* Deleted; | ||
37 | /// The flag for a message being replied to by the user. | ||
38 | extern const char* Answered; | ||
39 | /// The flag for a message being marked as flagged. | ||
40 | extern const char* Flagged; | ||
41 | } | ||
42 | |||
31 | struct Message { | 43 | struct Message { |
32 | qint64 uid; | 44 | qint64 uid; |
33 | qint64 size; | 45 | qint64 size; |
@@ -37,11 +49,17 @@ struct Message { | |||
37 | }; | 49 | }; |
38 | 50 | ||
39 | struct Folder { | 51 | struct Folder { |
52 | QString normalizedPath() const | ||
53 | { | ||
54 | return pathParts.join('/'); | ||
55 | } | ||
56 | |||
40 | QList<QString> pathParts; | 57 | QList<QString> pathParts; |
41 | }; | 58 | }; |
42 | 59 | ||
43 | class ImapServerProxy { | 60 | class ImapServerProxy { |
44 | KIMAP::Session *mSession; | 61 | KIMAP::Session *mSession; |
62 | QChar mSeparatorCharacter; | ||
45 | public: | 63 | public: |
46 | ImapServerProxy(const QString &serverUrl, int port); | 64 | ImapServerProxy(const QString &serverUrl, int port); |
47 | 65 | ||
@@ -49,7 +67,10 @@ public: | |||
49 | KAsync::Job<void> login(const QString &username, const QString &password); | 67 | KAsync::Job<void> login(const QString &username, const QString &password); |
50 | KAsync::Job<void> select(const QString &mailbox); | 68 | KAsync::Job<void> select(const QString &mailbox); |
51 | KAsync::Job<void> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime()); | 69 | KAsync::Job<void> append(const QString &mailbox, const QByteArray &content, const QList<QByteArray> &flags = QList<QByteArray>(), const QDateTime &internalDate = QDateTime()); |
70 | KAsync::Job<void> store(const KIMAP::ImapSet &set, const QList<QByteArray> &flags); | ||
52 | KAsync::Job<void> create(const QString &mailbox); | 71 | KAsync::Job<void> create(const QString &mailbox); |
72 | KAsync::Job<void> remove(const QString &mailbox); | ||
73 | KAsync::Job<void> expunge(); | ||
53 | 74 | ||
54 | typedef std::function<void(const QString &, | 75 | typedef std::function<void(const QString &, |
55 | const QMap<qint64,qint64> &, | 76 | const QMap<qint64,qint64> &, |
@@ -63,6 +84,7 @@ public: | |||
63 | 84 | ||
64 | //Composed calls that do login etc. | 85 | //Composed calls that do login etc. |
65 | KAsync::Job<QList<qint64>> fetchHeaders(const QString &mailbox); | 86 | KAsync::Job<QList<qint64>> fetchHeaders(const QString &mailbox); |
87 | KAsync::Job<void> remove(const QString &mailbox, const QByteArray &imapSet); | ||
66 | 88 | ||
67 | KAsync::Future<void> fetchFolders(std::function<void(const QVector<Folder> &)> callback); | 89 | KAsync::Future<void> fetchFolders(std::function<void(const QVector<Folder> &)> callback); |
68 | KAsync::Future<void> fetchMessages(const Folder &folder, std::function<void(const QVector<Message> &)> callback); | 90 | KAsync::Future<void> fetchMessages(const Folder &folder, std::function<void(const QVector<Message> &)> callback); |