summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/invoker/imap/IMAPInvoker.h')
-rw-r--r--src/uscxml/plugins/invoker/imap/IMAPInvoker.h103
1 files changed, 98 insertions, 5 deletions
diff --git a/src/uscxml/plugins/invoker/imap/IMAPInvoker.h b/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
index 5ffa727..3c367da 100644
--- a/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
+++ b/src/uscxml/plugins/invoker/imap/IMAPInvoker.h
@@ -21,6 +21,7 @@
#define IMAPINVOKER_H_W09JFED0
#include <uscxml/Interpreter.h>
+#include <uscxml/concurrency/BlockingQueue.h>
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
@@ -51,21 +52,113 @@ public:
protected:
class IMAPContext {
+
public:
+ enum Cmd {
+ // valid in authenticated state
+ SELECT,
+ EXAMINE,
+ CREATE,
+ DELETE,
+ RENAME,
+ SUBSCRIBE,
+ UNSUBSCRIBE,
+ LIST,
+ LSUB,
+ STATUS,
+ APPEND,
+ // valid in selected state
+ CHECK,
+ CLOSE,
+ EXPUNGE,
+ SEARCH,
+ FETCH,
+ STORE,
+ COPY,
+ UID,
+ XEXTENSION,
+ };
+
+ struct MailboxOp {
+ std::string mailbox;
+ };
+
+ struct Select : MailboxOp {};
+ struct Examine : MailboxOp {};
+ struct Create : MailboxOp {};
+ struct Delete : MailboxOp {};
+ struct Rename : MailboxOp {
+ std::string newName;
+ };
+ struct Subscribe : MailboxOp {};
+ struct Unsubscribe : MailboxOp {};
+ struct List : MailboxOp {
+ std::string refName;
+ };
+ struct LSub : List {};
+ struct Status : MailboxOp {
+ std::string dataItems;
+ };
+ struct Append : MailboxOp {
+ std::string flags;
+ std::string dateTime;
+ std::string literal;
+ };
+ struct Check {};
+ struct Close {};
+ struct Expunge {};
+ struct Search {
+ std::string charSet;
+ std::string criteria;
+ };
+ struct Fetch {
+ std::string sequence;
+ std::string itemNames;
+ };
+ struct Store : Fetch {
+ std::string values;
+ };
+ struct Copy : MailboxOp {
+ std::string sequence;
+ };
+ struct UId {
+ std::string command;
+ std::string arguments;
+ };
+ struct XExtension : UId {};
+
+
IMAPContext() : readPtr(0) {}
- std::string content;
- size_t readPtr;
+
+ void* arguments;
+ Cmd command;
+
IMAPInvoker* invoker;
+ SendRequest sendReq;
+ std::stringstream inContent;
+ std::string outContent;
+ size_t readPtr;
+ bool verbose;
+ bool useSSL;
+
};
- CURL* _curl;
+protected:
std::string _username;
std::string _password;
std::string _server;
- std::list<std::string> getAtoms(std::list<Data> list);
- void getAttachments(std::list<Data> list, std::list<Data>& attachments);
+ static void run(void*);
+
+ tthread::thread* _thread;
+ uscxml::concurrency::BlockingQueue<IMAPContext*> _workQueue;
+ bool _isRunning;
+
+ void process(IMAPContext* ctx);
static size_t writeCurlData(void *ptr, size_t size, size_t nmemb, void *userdata);
+ static size_t readCurlData(void *ptr, size_t size, size_t nmemb, void *userdata);
+
+// Data parseListReponse(const std::string& response);
};
#ifdef BUILD_AS_PLUGINS