aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async
diff options
context:
space:
mode:
authorGravatar libec <libor.huspenina@gmail.com>2015-11-04 10:27:51 +0100
committerGravatar libec <libor.huspenina@gmail.com>2015-11-04 10:27:51 +0100
commit6a4a30034edc7d7b3f0a824e9b38f43d4b9910df (patch)
tree24b1fa27ba31a06c95817fbd22f0123f6452b6e9 /src/async
parente3a1b98d0ed520683f4e13a734d4a397ab761f5f (diff)
adds support to send custom IMAP command
Diffstat (limited to 'src/async')
-rwxr-xr-xsrc/async/imap/MCAsyncIMAP.h1
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.cpp12
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.h2
-rw-r--r--src/async/imap/MCIMAPCustomCommandOperation.cpp36
-rw-r--r--src/async/imap/MCIMAPCustomCommandOperation.h37
5 files changed, 88 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/MCIMAPAsyncSession.cpp b/src/async/imap/MCIMAPAsyncSession.cpp
index ab1bbd95..15d546d5 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::sendCustomCommand(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..42fedcfb 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 * sendCustomCommand(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..692c8f7d
--- /dev/null
+++ b/src/async/imap/MCIMAPCustomCommandOperation.cpp
@@ -0,0 +1,36 @@
+//
+// 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;
+}
+
+IMAPCustomCommandOperation::~IMAPCustomCommandOperation()
+{
+ MC_SAFE_RELEASE(mCustomCommand);
+}
+
+void IMAPCustomCommandOperation::setCustomCommand(mailcore::String * command)
+{
+ mCustomCommand = command;
+}
+
+void IMAPCustomCommandOperation::main()
+{
+
+ session()->session()->sendCustomCommand(mCustomCommand);
+
+}
diff --git a/src/async/imap/MCIMAPCustomCommandOperation.h b/src/async/imap/MCIMAPCustomCommandOperation.h
new file mode 100644
index 00000000..83e6c11f
--- /dev/null
+++ b/src/async/imap/MCIMAPCustomCommandOperation.h
@@ -0,0 +1,37 @@
+//
+// 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);
+
+ public: // subclass behavior
+ virtual void main();
+
+ private:
+ String * mCustomCommand;
+ };
+
+}
+
+#endif
+
+#endif