aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async
diff options
context:
space:
mode:
Diffstat (limited to 'src/async')
-rwxr-xr-xsrc/async/imap/MCAsyncIMAP.h1
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncConnection.cpp1
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.cpp12
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.h2
-rw-r--r--src/async/imap/MCIMAPCustomCommandOperation.cpp44
-rw-r--r--src/async/imap/MCIMAPCustomCommandOperation.h39
6 files changed, 99 insertions, 0 deletions
diff --git a/src/async/imap/MCAsyncIMAP.h b/src/async/imap/MCAsyncIMAP.h
index 8a490aa8..aa6d6b68 100755
--- a/src/async/imap/MCAsyncIMAP.h
+++ b/src/async/imap/MCAsyncIMAP.h
@@ -33,5 +33,6 @@
#include <MailCore/MCIMAPQuotaOperation.h>
#include <MailCore/MCIMAPOperationCallback.h>
#include <MailCore/MCIMAPMessageRenderingOperation.h>
+#include <MailCore/MCIMAPCustomCommandOperation.h>
#endif
diff --git a/src/async/imap/MCIMAPAsyncConnection.cpp b/src/async/imap/MCIMAPAsyncConnection.cpp
index c03422ff..0dc29ee0 100755
--- a/src/async/imap/MCIMAPAsyncConnection.cpp
+++ b/src/async/imap/MCIMAPAsyncConnection.cpp
@@ -38,6 +38,7 @@
#include "MCIMAPAsyncSession.h"
#include "MCConnectionLogger.h"
#include "MCIMAPMessageRenderingOperation.h"
+#include "MCIMAPCustomCommandOperation.h"
#include "MCIMAPIdentity.h"
using namespace mailcore;
diff --git a/src/async/imap/MCIMAPAsyncSession.cpp b/src/async/imap/MCIMAPAsyncSession.cpp
index ab1bbd95..a8cccea5 100755
--- a/src/async/imap/MCIMAPAsyncSession.cpp
+++ b/src/async/imap/MCIMAPAsyncSession.cpp
@@ -42,6 +42,7 @@
#include "MCIMAPDisconnectOperation.h"
#include "MCIMAPNoopOperation.h"
#include "MCIMAPMessageRenderingOperation.h"
+#include "MCIMAPCustomCommandOperation.h"
#define DEFAULT_MAX_CONNECTIONS 3
@@ -536,6 +537,17 @@ IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageByNumberOperation(Stri
return op;
}
+IMAPCustomCommandOperation * IMAPAsyncSession::customCommand(String *command, bool urgent)
+{
+
+ IMAPCustomCommandOperation *op = new IMAPCustomCommandOperation();
+ op->setMainSession(this);
+ op->setCustomCommand(command);
+ op->setUrgent(urgent);
+ op->autorelease();
+ return op;
+}
+
IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageAttachmentByNumberOperation(String * folder, uint32_t number, String * partID,
Encoding encoding, bool urgent)
{
diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h
index 86378926..62577a6e 100755
--- a/src/async/imap/MCIMAPAsyncSession.h
+++ b/src/async/imap/MCIMAPAsyncSession.h
@@ -40,6 +40,7 @@ namespace mailcore {
class IMAPSession;
class IMAPIdentity;
class OperationQueueCallback;
+ class IMAPCustomCommandOperation;
class MAILCORE_EXPORT IMAPAsyncSession : public Object {
public:
@@ -135,6 +136,7 @@ namespace mailcore {
Encoding encoding, bool urgent = false);
virtual IMAPFetchContentOperation * fetchMessageByNumberOperation(String * folder, uint32_t number, bool urgent = false);
+ virtual IMAPCustomCommandOperation * customCommand(String *command, bool urgent);
virtual IMAPFetchContentOperation * fetchMessageAttachmentByNumberOperation(String * folder, uint32_t number, String * partID,
Encoding encoding, bool urgent = false);
diff --git a/src/async/imap/MCIMAPCustomCommandOperation.cpp b/src/async/imap/MCIMAPCustomCommandOperation.cpp
new file mode 100644
index 00000000..3995d6aa
--- /dev/null
+++ b/src/async/imap/MCIMAPCustomCommandOperation.cpp
@@ -0,0 +1,44 @@
+//
+// MCIMAPCustomCommandOperation.cpp
+// mailcore2
+//
+// Created by Libor Huspenina on 18/10/2015.
+// Copyright © 2015 MailCore. All rights reserved.
+//
+
+#include "MCIMAPCustomCommandOperation.h"
+
+#include "MCIMAPSession.h"
+#include "MCIMAPAsyncConnection.h"
+
+using namespace mailcore;
+
+IMAPCustomCommandOperation::IMAPCustomCommandOperation()
+{
+ mCustomCommand = NULL;
+ mResponse = NULL;
+}
+
+IMAPCustomCommandOperation::~IMAPCustomCommandOperation()
+{
+ MC_SAFE_RELEASE(mCustomCommand);
+ MC_SAFE_RELEASE(mResponse);
+}
+
+void IMAPCustomCommandOperation::setCustomCommand(String * command)
+{
+ MC_SAFE_REPLACE_COPY(String, mCustomCommand, command);
+}
+
+String * IMAPCustomCommandOperation::response()
+{
+ return mResponse;
+}
+
+void IMAPCustomCommandOperation::main()
+{
+ ErrorCode error;
+ mResponse = session()->session()->customCommand(mCustomCommand, &error);
+ MC_SAFE_RETAIN(mResponse);
+ setError(error);
+}
diff --git a/src/async/imap/MCIMAPCustomCommandOperation.h b/src/async/imap/MCIMAPCustomCommandOperation.h
new file mode 100644
index 00000000..a2ce20fe
--- /dev/null
+++ b/src/async/imap/MCIMAPCustomCommandOperation.h
@@ -0,0 +1,39 @@
+//
+// MCIMAPCustomCommandOperation.h
+// mailcore2
+//
+// Created by Libor Huspenina on 18/10/2015.
+// Copyright © 2015 MailCore. All rights reserved.
+//
+
+#ifndef MAILCORE_MCIMAPCUSTOMCOMMANDOPERATION_H
+
+#define MAILCORE_MCIMAPCUSTOMCOMMANDOPERATION_H
+
+#include <MailCore/MCIMAPOperation.h>
+
+#ifdef __cplusplus
+
+namespace mailcore {
+
+ class MAILCORE_EXPORT IMAPCustomCommandOperation : public IMAPOperation {
+ public:
+ IMAPCustomCommandOperation();
+ virtual ~IMAPCustomCommandOperation();
+
+ virtual void setCustomCommand(String *command);
+ virtual String * response();
+
+ public: // subclass behavior
+ virtual void main();
+
+ private:
+ String * mCustomCommand;
+ String * mResponse;
+ };
+
+}
+
+#endif
+
+#endif