aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async
diff options
context:
space:
mode:
authorGravatar DINH Viet Hoa <hoa@sprw.me>2013-01-11 01:08:18 -0800
committerGravatar DINH Viet Hoa <hoa@sprw.me>2013-01-11 01:08:18 -0800
commit739b68a69682d80d8247d4465eae7b182acc9da0 (patch)
tree34c33738bc0761d30c13f7f9b88fdf0d5c8cb4a9 /src/async
parentf83e0e9ba3da2b8887f849483506d5de8f1d2c54 (diff)
first commit
Diffstat (limited to 'src/async')
-rw-r--r--src/async/imap/IMAPAsyncSession.h122
-rw-r--r--src/async/smtp/MCSMTPAsyncSession.cc147
-rw-r--r--src/async/smtp/MCSMTPAsyncSession.h73
-rw-r--r--src/async/smtp/MCSMTPSendWithBuilderOperation.cc9
-rw-r--r--src/async/smtp/MCSMTPSendWithBuilderOperation.h14
-rw-r--r--src/async/smtp/MCSMTPSendWithDataOperation.cc9
-rw-r--r--src/async/smtp/MCSMTPSendWithDataOperation.h14
-rw-r--r--src/async/smtp/MCSMTPSendWithRecipientOperation.cc9
-rw-r--r--src/async/smtp/MCSMTPSendWithRecipientOperation.h13
9 files changed, 410 insertions, 0 deletions
diff --git a/src/async/imap/IMAPAsyncSession.h b/src/async/imap/IMAPAsyncSession.h
new file mode 100644
index 00000000..1e32bc46
--- /dev/null
+++ b/src/async/imap/IMAPAsyncSession.h
@@ -0,0 +1,122 @@
+#ifndef __MAILCORE_MCIMAPASYNCSESSION_H
+
+#define __MAILCORE_MCIMAPASYNCSESSION_H
+
+#include <mailcore/CBaseTypes.h>
+#include <mailcore/MessageConstants.h>
+
+namespace mailcore {
+
+ class IMAPOperation;
+ class IMAPFetchFoldersOperation;
+ class IMAPAppendOperation;
+ class IMAPCopyOperation;
+ class IMAPFetchMessagesOperation;
+ class IMAPIdleOperation;
+ class IMAPSession;
+ class IMAPNamespace;
+
+ class IMAPSession : public Object {
+ private:
+ String * mHostname;
+ unsigned int mPort;
+ String * mUsername;
+ String * mPassword;
+ AuthType mAuthType;
+ ConnectionType mConnectionType;
+ bool mCheckCertificateEnabled;
+ bool mVoIPEnabled;
+ char mDelimiter;
+ IMAPNamespace * mDefaultNamespace;
+
+ IMAPSession * mSession;
+
+ public:
+ IMAPAsyncSession();
+ virtual ~IMAPAsyncSession();
+
+ virtual String * className();
+
+ virtual void setHostname(String * hostname);
+ virtual String * hostname();
+
+ virtual void setPort(unsigned int port);
+ virtual unsigned int port();
+
+ virtual void setUsername(String * login);
+ virtual String * username();
+
+ virtual void setPassword(String * password);
+ virtual String * password();
+
+ virtual void setAuthType(AuthType authType);
+ virtual AuthType authType();
+
+ virtual void setConnectionType(ConnectionType connectionType);
+ virtual ConnectionType connectionType();
+
+ virtual void setTimeout(time_t timeout);
+ virtual time_t timeout();
+
+ virtual void setCheckCertificateEnabled(bool enabled);
+ virtual bool isCheckCertificateEnabled();
+
+ virtual void setVoIPEnabled(bool enabled);
+ virtual bool isVoIPEnabled();
+
+ virtual void setDelimiter(char delimiter);
+ virtual char delimiter();
+
+ virtual void setDefaultNamespace(IMAPNamespace * ns);
+ virtual IMAPNamespace * defaultNamespace();
+
+ virtual IMAPOperation * select(String * folder);
+
+ virtual IMAPFetchFoldersOperation * fetchSubscribedFolders();
+ virtual IMAPFetchFoldersOperation * fetchAllFolders();
+
+ virtual IMAPOperation * renameFolder(String * folder, String * otherName);
+ virtual IMAPOperation * deleteFolder(String * folder, ErrorCode * pError);
+ virtual IMAPOperation * createFolder(String * folder, ErrorCode * pError);
+
+ virtual IMAPOperation * subscribeFolder(String * folder, ErrorCode * pError);
+ virtual IMAPOperation * unsubscribeFolder(String * folder, ErrorCode * pError);
+
+ virtual IMAPAppendOperation * appendMessage(String * folder, Data * messageData, MessageFlag flags);
+
+ virtual IMAPCopyOperation * copyMessages(String * folder, Array * uidSet, String * destFolder);
+
+ virtual IMAPOperation * expunge(String * folder);
+
+ virtual IMAPFetchMessagesOperation * fetchMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
+ uint32_t firstUID, uint32_t lastUID);
+ virtual IMAPFetchMessagesOperation * fetchMessagesByNumber(String * folder, IMAPMessagesRequestKind requestKind,
+ uint32_t firstNumber, uint32_t lastNumber);
+ virtual IMAPFetchMessagesOperation * fetchMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
+ Array * numbers);
+ virtual IMAPFetchMessagesOperation * fetchMessagesByNumber(String * folder, IMAPMessagesRequestKind requestKind,
+ Array * numbers);
+ virtual IMAPFetchMessageOperation * fetchMessageByUID(String * folder, uint32_t uid);
+ virtual IMAPFetchMessageOperation * fetchMessageAttachmentByUID(String * folder, uint32_t uid, String * partID,
+ Encoding encoding, unsigned int expectedSize);
+
+ virtual IMAPOperation * storeFlags(String * folder, Array * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags);
+ virtual IMAPOperation * storeLabels(String * folder, Array * uids, IMAPStoreFlagsRequestKind kind, Array * labels);
+
+ virtual Array * search(String * folder, IMAPSearchKind kind, String * searchString);
+ virtual Array * search(String * folder, IMAPSearchExpression * expression);
+
+ virtual IMAPIdleOperation * idle(String * folder, uint32_t lastKnownUID);
+
+ virtual IMAPOperation * connect();
+ virtual IMAPOperation * disconnect();
+
+ virtual IMAPOperation * fetchNamespace();
+
+ virtual IMAPOperation * login();
+
+ virtual IMAPOperation * identity(String * vendor, String * name, String * version);
+ };
+}
+
+#endif
diff --git a/src/async/smtp/MCSMTPAsyncSession.cc b/src/async/smtp/MCSMTPAsyncSession.cc
new file mode 100644
index 00000000..9798fc0c
--- /dev/null
+++ b/src/async/smtp/MCSMTPAsyncSession.cc
@@ -0,0 +1,147 @@
+#include "MCSMTPAsyncSession.h"
+
+#include "MCSMTPSession.h"
+#include "MCSMTPSendWithRecipientOperation.h"
+#include "MCSMTPSendWithDataOperation.h"
+#include "MCSMTPSendWithBuilderOperation.h"
+
+using namespace mailcore;
+
+SMTPAsyncSession::SMTPAsyncSession()
+{
+ mSession = new SMTPSession();
+ mQueue = new OperationQueue();
+}
+
+SMTPAsyncSession::~SMTPAsyncSession()
+{
+ mQueue->release();
+ mSession->release();
+}
+
+String * SMTPAsyncSession::className()
+{
+ return MCSTR("SMTPAsyncSession");
+}
+
+void SMTPAsyncSession::setHostname(String * hostname)
+{
+ mSession->setHostname(hostname);
+}
+
+String * SMTPAsyncSession::hostname()
+{
+ return mSession->hostname();
+}
+
+void SMTPAsyncSession::setPort(unsigned int port)
+{
+ mSession->setPort(port);
+}
+
+unsigned int SMTPAsyncSession::port()
+{
+ return mSession->port();
+}
+
+void SMTPAsyncSession::setUsername(String * username)
+{
+ return mSession->setUsername(username);
+}
+
+String * SMTPAsyncSession::username()
+{
+ return mSession->username();
+}
+
+void SMTPAsyncSession::setPassword(String * password)
+{
+ mSession->setPassword(password);
+}
+
+String * SMTPAsyncSession::password()
+{
+ return mSession->password();
+}
+
+void SMTPAsyncSession::setAuthType(AuthType authType)
+{
+ mSession->setAuthType(authType);
+}
+
+AuthType SMTPAsyncSession::authType()
+{
+ return mSession->authType();
+}
+
+void SMTPAsyncSession::setConnectionType(ConnectionType connectionType)
+{
+ mSession->setConnectionType(connectionType);
+}
+
+ConnectionType SMTPAsyncSession::connectionType()
+{
+ return mSession->connectionType();
+}
+
+void SMTPAsyncSession::setTimeout(time_t timeout)
+{
+ return mSession->setTimeout(timeout);
+}
+
+time_t SMTPAsyncSession::timeout()
+{
+ return mSession->timeout();
+}
+
+void SMTPAsyncSession::setCheckCertificateEnabled(bool enabled)
+{
+ return mSession->setCheckCertificateEnabled(enabled);
+}
+
+bool SMTPAsyncSession::isCheckCertificateEnabled()
+{
+ return mSession->isCheckCertificateEnabled();
+}
+
+void SMTPAsyncSession::setUseHeloIPEnabled(bool enabled)
+{
+ mSession->setUseHeloIPEnabled(enabled);
+}
+
+bool SMTPAsyncSession::useHeloIPEnabled()
+{
+ return mSession->useHeloIPEnabled();
+}
+
+SMTPOperation * sendMessage(Address * from, Array * recipients, Data * messageData)
+{
+#if 0
+ SMTPSendWithRecipientOperation * op = new SMTPSendWithRecipientOperation();
+ op->setFrom(from);
+ op->setRecipients(recipients);
+ op->messageData(messageData);
+ return (SMTPOperation *) op->autorelease();
+#endif
+ return NULL;
+}
+
+SMTPOperation * sendMessage(Data * messageData)
+{
+#if 0
+ SMTPSendWithDataOperation * op = new SMTPSendWithDataOperation();
+ op->setData(messageData);
+ return (SMTPOperation *) op->autorelease();
+#endif
+ return NULL;
+}
+
+SMTPOperation * sendMessage(MessageBuilder * msg)
+{
+#if 0
+ SMTPSendWithBuilderOperation * op = new SMTPSendWithBuilderOperation();
+ op->setBuilder(msg);
+ return (SMTPOperation *) op->autorelease();
+#endif
+ return NULL;
+}
diff --git a/src/async/smtp/MCSMTPAsyncSession.h b/src/async/smtp/MCSMTPAsyncSession.h
new file mode 100644
index 00000000..8e0e50b0
--- /dev/null
+++ b/src/async/smtp/MCSMTPAsyncSession.h
@@ -0,0 +1,73 @@
+#ifndef __MAILCORE_MCSMTPASYNCSESSION_H
+
+#define __MAILCORE_MCSMTPASYNCSESSION_H
+
+#include <mailcore/MCBaseTypes.h>
+#include <mailcore/MCMessageConstants.h>
+#include <libetpan/libetpan.h>
+
+namespace mailcore {
+
+ class MessageBuilder;
+ class SMTPOperation;
+ class SMTPSession;
+ class Address;
+
+ class SMTPAsyncSession : public Object {
+ private:
+ String * mHostname;
+ unsigned int mPort;
+ String * mUsername;
+ String * mPassword;
+ AuthType mAuthType;
+ ConnectionType mConnectionType;
+ time_t mTimeout;
+ bool mCheckCertificateEnabled;
+ bool mUseHeloIPEnabled;
+
+ SMTPSession * mSession;
+ OperationQueue * mQueue;
+
+ void queue(SMTPOperation * op);
+
+ public:
+ SMTPAsyncSession();
+ virtual ~SMTPAsyncSession();
+
+ virtual String * className();
+
+ virtual void setHostname(String * hostname);
+ virtual String * hostname();
+
+ virtual void setPort(unsigned int port);
+ virtual unsigned int port();
+
+ virtual void setUsername(String * username);
+ virtual String * username();
+
+ virtual void setPassword(String * password);
+ virtual String * password();
+
+ virtual void setAuthType(AuthType authType);
+ virtual AuthType authType();
+
+ virtual void setConnectionType(ConnectionType connectionType);
+ virtual ConnectionType connectionType();
+
+ virtual void setTimeout(time_t timeout);
+ virtual time_t timeout();
+
+ virtual void setCheckCertificateEnabled(bool enabled);
+ virtual bool isCheckCertificateEnabled();
+
+ virtual void setUseHeloIPEnabled(bool enabled);
+ virtual bool useHeloIPEnabled();
+
+ virtual SMTPOperation * sendMessage(Address * from, Array * recipients, Data * messageData);
+ virtual SMTPOperation * sendMessage(Data * messageData);
+ virtual SMTPOperation * sendMessage(MessageBuilder * msg);
+ };
+
+}
+
+#endif
diff --git a/src/async/smtp/MCSMTPSendWithBuilderOperation.cc b/src/async/smtp/MCSMTPSendWithBuilderOperation.cc
new file mode 100644
index 00000000..560998ff
--- /dev/null
+++ b/src/async/smtp/MCSMTPSendWithBuilderOperation.cc
@@ -0,0 +1,9 @@
+//
+// SMTPSendWithBuilderOperation.cc
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCSMTPSendWithBuilderOperation.h"
diff --git a/src/async/smtp/MCSMTPSendWithBuilderOperation.h b/src/async/smtp/MCSMTPSendWithBuilderOperation.h
new file mode 100644
index 00000000..d306e30c
--- /dev/null
+++ b/src/async/smtp/MCSMTPSendWithBuilderOperation.h
@@ -0,0 +1,14 @@
+//
+// SMTPSendWithBuilderOperation.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __mailcore2__MCSMTPSendWithBuilderOperation__
+#define __mailcore2__MCSMTPSendWithBuilderOperation__
+
+#include <iostream>
+
+#endif /* defined(__mailcore2__SMTPSendWithBuilderOperation__) */
diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.cc b/src/async/smtp/MCSMTPSendWithDataOperation.cc
new file mode 100644
index 00000000..ab42aa0e
--- /dev/null
+++ b/src/async/smtp/MCSMTPSendWithDataOperation.cc
@@ -0,0 +1,9 @@
+//
+// SMTPSendWithDataOperation.cc
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCSMTPSendWithDataOperation.h"
diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.h b/src/async/smtp/MCSMTPSendWithDataOperation.h
new file mode 100644
index 00000000..c13ee07d
--- /dev/null
+++ b/src/async/smtp/MCSMTPSendWithDataOperation.h
@@ -0,0 +1,14 @@
+//
+// SMTPSendWithDataOperation.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __mailcore2__MCSMTPSendWithDataOperation__
+#define __mailcore2__MCSMTPSendWithDataOperation__
+
+#include <iostream>
+
+#endif /* defined(__mailcore2__SMTPSendWithDataOperation__) */
diff --git a/src/async/smtp/MCSMTPSendWithRecipientOperation.cc b/src/async/smtp/MCSMTPSendWithRecipientOperation.cc
new file mode 100644
index 00000000..5fee7fa3
--- /dev/null
+++ b/src/async/smtp/MCSMTPSendWithRecipientOperation.cc
@@ -0,0 +1,9 @@
+//
+// SMTPSendWithRecipientOperation.cc
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCSMTPSendWithRecipientOperation.h"
diff --git a/src/async/smtp/MCSMTPSendWithRecipientOperation.h b/src/async/smtp/MCSMTPSendWithRecipientOperation.h
new file mode 100644
index 00000000..f4134688
--- /dev/null
+++ b/src/async/smtp/MCSMTPSendWithRecipientOperation.h
@@ -0,0 +1,13 @@
+//
+// SMTPSendWithRecipientOperation.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/10/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __mailcore2__MCSMTPSendWithRecipientOperation__
+#define __mailcore2__MCSMTPSendWithRecipientOperation__
+
+
+#endif /* defined(__mailcore2__SMTPSendWithRecipientOperation__) */