aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async/imap/MCIMAPSubscribeFolderOperation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/async/imap/MCIMAPSubscribeFolderOperation.cpp')
-rw-r--r--src/async/imap/MCIMAPSubscribeFolderOperation.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/async/imap/MCIMAPSubscribeFolderOperation.cpp b/src/async/imap/MCIMAPSubscribeFolderOperation.cpp
new file mode 100644
index 00000000..1eedad29
--- /dev/null
+++ b/src/async/imap/MCIMAPSubscribeFolderOperation.cpp
@@ -0,0 +1,45 @@
+//
+// MCIMAPSubscribeFolderOperation.cpp
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/12/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCIMAPSubscribeFolderOperation.h"
+
+#include "MCIMAPSession.h"
+#include "MCIMAPAsyncConnection.h"
+
+using namespace mailcore;
+
+IMAPSubscribeFolderOperation::IMAPSubscribeFolderOperation()
+{
+ mUnsubscribeEnabled = false;
+}
+
+IMAPSubscribeFolderOperation::~IMAPSubscribeFolderOperation()
+{
+}
+
+void IMAPSubscribeFolderOperation::setUnsubscribeEnabled(bool enabled)
+{
+ mUnsubscribeEnabled = enabled;
+}
+
+bool IMAPSubscribeFolderOperation::isUnsubscribeEnabled()
+{
+ return mUnsubscribeEnabled;
+}
+
+void IMAPSubscribeFolderOperation::main()
+{
+ ErrorCode error;
+ if (mUnsubscribeEnabled) {
+ session()->session()->unsubscribeFolder(folder(), &error);
+ }
+ else {
+ session()->session()->subscribeFolder(folder(), &error);
+ }
+ setError(error);
+}