aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async/imap/MCIMAPFetchFoldersOperation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/async/imap/MCIMAPFetchFoldersOperation.cpp')
-rw-r--r--src/async/imap/MCIMAPFetchFoldersOperation.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/async/imap/MCIMAPFetchFoldersOperation.cpp b/src/async/imap/MCIMAPFetchFoldersOperation.cpp
new file mode 100644
index 00000000..e1f121e8
--- /dev/null
+++ b/src/async/imap/MCIMAPFetchFoldersOperation.cpp
@@ -0,0 +1,55 @@
+//
+// MCIMAPFetchFoldersOperation.cpp
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 1/12/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCIMAPFetchFoldersOperation.h"
+
+#include <stdlib.h>
+
+#include "MCIMAPSession.h"
+#include "MCIMAPAsyncConnection.h"
+
+using namespace mailcore;
+
+IMAPFetchFoldersOperation::IMAPFetchFoldersOperation()
+{
+ mFetchSubscribedEnabled = false;
+ mFolders = NULL;
+}
+
+IMAPFetchFoldersOperation::~IMAPFetchFoldersOperation()
+{
+ MC_SAFE_RELEASE(mFolders);
+}
+
+void IMAPFetchFoldersOperation::setFetchSubscribedEnabled(bool enabled)
+{
+ mFetchSubscribedEnabled = enabled;
+}
+
+bool IMAPFetchFoldersOperation::isFetchSubscribedEnabled()
+{
+ return mFetchSubscribedEnabled;
+}
+
+Array * IMAPFetchFoldersOperation::folders()
+{
+ return mFolders;
+}
+
+void IMAPFetchFoldersOperation::main()
+{
+ ErrorCode error;
+ if (mFetchSubscribedEnabled) {
+ mFolders = session()->session()->fetchSubscribedFolders(&error);
+ }
+ else {
+ mFolders = session()->session()->fetchAllFolders(&error);
+ }
+ MC_SAFE_RETAIN(mFolders);
+ setError(error);
+}