aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoà V. DINH <dinh.viet.hoa@gmail.com>2013-08-09 10:15:17 -0700
committerGravatar Hoà V. DINH <dinh.viet.hoa@gmail.com>2013-08-09 10:15:17 -0700
commit9bb099e06a626e6614628c25002a78ca7b2a01bf (patch)
tree6a6e1edc25854c5b32b3ead90e9157182ee14842
parentd5ed180d3615e668a59d098156189616b596a67a (diff)
parent1e05ee7ea55905b26b4b9e8545c881f63b2cdf6f (diff)
Merge pull request #289 from soxjke/getQuotaBranch
Added quotaOperation to get used and total space in IMAP account.
-rwxr-xr-x[-rw-r--r--]build-mac/mailcore2.xcodeproj/project.pbxproj24
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCAsyncIMAP.h1
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncConnection.cc9
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncConnection.h2
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncSession.cc6
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncSession.h2
-rw-r--r--src/async/imap/MCIMAPQuotaOperation.cc41
-rw-r--r--src/async/imap/MCIMAPQuotaOperation.h39
-rwxr-xr-x[-rw-r--r--]src/core/imap/MCIMAPSession.cc35
-rwxr-xr-x[-rw-r--r--]src/core/imap/MCIMAPSession.h1
-rwxr-xr-x[-rw-r--r--]src/objc/imap/MCOIMAP.h1
-rw-r--r--src/objc/imap/MCOIMAPQuotaOperation.h15
-rw-r--r--src/objc/imap/MCOIMAPQuotaOperation.mm69
-rwxr-xr-x[-rw-r--r--]src/objc/imap/MCOIMAPSession.h3
-rwxr-xr-x[-rw-r--r--]src/objc/imap/MCOIMAPSession.mm6
15 files changed, 254 insertions, 0 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj
index 9a1c64c3..9c9efc3c 100644..100755
--- a/build-mac/mailcore2.xcodeproj/project.pbxproj
+++ b/build-mac/mailcore2.xcodeproj/project.pbxproj
@@ -7,6 +7,14 @@
objects = {
/* Begin PBXBuildFile section */
+ 4B3C1BDE17ABF309008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */; };
+ 4B3C1BE117ABF4BC008BBF4C /* MCIMAPQuotaOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */; };
+ 4B3C1BE217ABFF7C008BBF4C /* MCOIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */; };
+ 4B3C1BE317ABFF91008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */; };
+ 4B3C1BE417AC0156008BBF4C /* MCIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */; };
+ 4B3C1BE517AC0176008BBF4C /* MCIMAPQuotaOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */; };
+ 4BE4029117B548B900ECC5E4 /* MCOIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */; };
+ 4BE4029217B548D900ECC5E4 /* MCIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */; };
84AF9E7E172DBAF600E60AA3 /* providers.json in Resources */ = {isa = PBXBuildFile; fileRef = 84AF9E7D172DBAF600E60AA3 /* providers.json */; };
9E774D891767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */; };
9E774D8A1767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */; };
@@ -733,6 +741,8 @@
dstPath = include/MailCore;
dstSubfolderSpec = 16;
files = (
+ 4BE4029217B548D900ECC5E4 /* MCIMAPQuotaOperation.h in CopyFiles */,
+ 4BE4029117B548B900ECC5E4 /* MCOIMAPQuotaOperation.h in CopyFiles */,
C6E665001790963E0063F2CF /* MCIMAPMessageRenderingOperation.h in CopyFiles */,
DAE42E89178F7E1800E0DB8F /* MCOIMAPMessageRenderingOperation.h in CopyFiles */,
9E774D8C1767CD490065EB9B /* MCIMAPFolderStatus.h in CopyFiles */,
@@ -922,6 +932,8 @@
dstPath = include/MailCore;
dstSubfolderSpec = 16;
files = (
+ 4B3C1BE417AC0156008BBF4C /* MCIMAPQuotaOperation.h in CopyFiles */,
+ 4B3C1BE217ABFF7C008BBF4C /* MCOIMAPQuotaOperation.h in CopyFiles */,
DAE42E8A178F7E2200E0DB8F /* MCOIMAPMessageRenderingOperation.h in CopyFiles */,
C6E6652F1791B2530063F2CF /* MCIMAPMessageRenderingOperation.h in CopyFiles */,
9E774D8B1767CD3C0065EB9B /* MCIMAPFolderStatus.h in CopyFiles */,
@@ -1099,6 +1111,10 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPQuotaOperation.h; sourceTree = "<group>"; };
+ 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPQuotaOperation.mm; sourceTree = "<group>"; };
+ 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPQuotaOperation.cc; sourceTree = "<group>"; };
+ 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPQuotaOperation.h; sourceTree = "<group>"; };
84AF9E7D172DBAF600E60AA3 /* providers.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = providers.json; path = ../resources/providers.json; sourceTree = "<group>"; };
9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPFolderStatus.h; sourceTree = "<group>"; };
9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPFolderStatus.cc; sourceTree = "<group>"; };
@@ -1750,6 +1766,8 @@
C62C6ED716A398FA00737497 /* MCIMAPFolderInfoOperation.h */,
C64BB22916E5C0A3000DB34C /* MCIMAPCapabilityOperation.cc */,
C64BB22A16E5C0A3000DB34C /* MCIMAPCapabilityOperation.h */,
+ 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */,
+ 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */,
9EF9AB10175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc */,
9EF9AB0E175F30C20027FA3B /* MCIMAPFolderStatusOperation.h */,
C6081679177635D2001F1018 /* MCIMAPDisconnectOperation.cc */,
@@ -2206,6 +2224,8 @@
C6F61F9217016B250073032E /* MCOIMAPIdentityOperation.mm */,
C6F61F9417016B310073032E /* MCOIMAPCapabilityOperation.h */,
C6F61F9517016B310073032E /* MCOIMAPCapabilityOperation.mm */,
+ 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */,
+ 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */,
C6F61F9717016B460073032E /* MCOIMAPSearchExpression.h */,
C6F61F9817016B460073032E /* MCOIMAPSearchExpression.mm */,
9EF9AB06175F2EC60027FA3B /* MCOIMAPFolderStatus.h */,
@@ -2589,6 +2609,8 @@
BD63713B177DFF080094121B /* MCLibetpan.cc in Sources */,
DAACAD5117886807000B4517 /* MCHTMLRendererIMAPDataCallback.cc in Sources */,
DA89896D178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm in Sources */,
+ 4B3C1BDE17ABF309008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */,
+ 4B3C1BE117ABF4BC008BBF4C /* MCIMAPQuotaOperation.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2780,6 +2802,8 @@
BD63713C177DFF080094121B /* MCLibetpan.cc in Sources */,
DAACAD5217886807000B4517 /* MCHTMLRendererIMAPDataCallback.cc in Sources */,
DA89896E178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm in Sources */,
+ 4B3C1BE317ABFF91008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */,
+ 4B3C1BE517AC0176008BBF4C /* MCIMAPQuotaOperation.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/async/imap/MCAsyncIMAP.h b/src/async/imap/MCAsyncIMAP.h
index a6bf40d0..66ba6c7b 100644..100755
--- a/src/async/imap/MCAsyncIMAP.h
+++ b/src/async/imap/MCAsyncIMAP.h
@@ -27,6 +27,7 @@
#include <MailCore/MCIMAPFetchNamespaceOperation.h>
#include <MailCore/MCIMAPIdentityOperation.h>
#include <MailCore/MCIMAPCapabilityOperation.h>
+#include <MailCore/MCIMAPQuotaOperation.h>
#include <MailCore/MCIMAPOperationCallback.h>
#include <MailCore/MCIMAPMessageRenderingOperation.h>
diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc
index 85c411a8..1472d974 100644..100755
--- a/src/async/imap/MCIMAPAsyncConnection.cc
+++ b/src/async/imap/MCIMAPAsyncConnection.cc
@@ -30,6 +30,7 @@
#include "MCIMAPIdleOperation.h"
#include "MCIMAPIdentityOperation.h"
#include "MCIMAPCapabilityOperation.h"
+#include "MCIMAPQuotaOperation.h"
#include "MCOperationQueueCallback.h"
#include "MCIMAPDisconnectOperation.h"
#include "MCIMAPAsyncSession.h"
@@ -494,6 +495,14 @@ IMAPCapabilityOperation * IMAPAsyncConnection::capabilityOperation()
return op;
}
+IMAPQuotaOperation * IMAPAsyncConnection::quotaOperation()
+{
+ IMAPQuotaOperation * op = new IMAPQuotaOperation();
+ op->setSession(this);
+ op->autorelease();
+ return op;
+}
+
IMAPSession * IMAPAsyncConnection::session()
{
return mSession;
diff --git a/src/async/imap/MCIMAPAsyncConnection.h b/src/async/imap/MCIMAPAsyncConnection.h
index 45acb707..13f9ff7b 100644..100755
--- a/src/async/imap/MCIMAPAsyncConnection.h
+++ b/src/async/imap/MCIMAPAsyncConnection.h
@@ -25,6 +25,7 @@ namespace mailcore {
class IMAPFetchNamespaceOperation;
class IMAPIdentityOperation;
class IMAPCapabilityOperation;
+ class IMAPQuotaOperation;
class IMAPOperationQueueCallback;
class IMAPAsyncSession;
class IMAPConnectionLogger;
@@ -120,6 +121,7 @@ namespace mailcore {
virtual IMAPOperation * checkAccountOperation();
virtual IMAPCapabilityOperation * capabilityOperation();
+ virtual IMAPQuotaOperation * quotaOperation();
virtual IMAPMessageRenderingOperation * htmlRenderingOperation(IMAPMessage * message, String * folder);
virtual IMAPMessageRenderingOperation * htmlBodyRenderingOperation(IMAPMessage * message, String * folder);
diff --git a/src/async/imap/MCIMAPAsyncSession.cc b/src/async/imap/MCIMAPAsyncSession.cc
index 7aa37d83..26c0feca 100644..100755
--- a/src/async/imap/MCIMAPAsyncSession.cc
+++ b/src/async/imap/MCIMAPAsyncSession.cc
@@ -449,6 +449,12 @@ IMAPCapabilityOperation * IMAPAsyncSession::capabilityOperation()
return session->capabilityOperation();
}
+IMAPQuotaOperation * IMAPAsyncSession::quotaOperation()
+{
+ IMAPAsyncConnection * session = sessionForFolder(MCSTR("INBOX"));
+ return session->quotaOperation();
+}
+
void IMAPAsyncSession::setConnectionLogger(ConnectionLogger * logger)
{
mConnectionLogger = logger;
diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h
index 68e8899a..e5c17078 100644..100755
--- a/src/async/imap/MCIMAPAsyncSession.h
+++ b/src/async/imap/MCIMAPAsyncSession.h
@@ -33,6 +33,7 @@ namespace mailcore {
class IMAPIdentityOperation;
class IMAPAsyncConnection;
class IMAPCapabilityOperation;
+ class IMAPQuotaOperation;
class IMAPMessageRenderingOperation;
class IMAPMessage;
@@ -133,6 +134,7 @@ namespace mailcore {
virtual IMAPOperation * checkAccountOperation();
virtual IMAPCapabilityOperation * capabilityOperation();
+ virtual IMAPQuotaOperation * quotaOperation();
virtual IMAPMessageRenderingOperation * htmlRenderingOperation(IMAPMessage * message, String * folder);
virtual IMAPMessageRenderingOperation * htmlBodyRenderingOperation(IMAPMessage * message, String * folder);
diff --git a/src/async/imap/MCIMAPQuotaOperation.cc b/src/async/imap/MCIMAPQuotaOperation.cc
new file mode 100644
index 00000000..6744ac4b
--- /dev/null
+++ b/src/async/imap/MCIMAPQuotaOperation.cc
@@ -0,0 +1,41 @@
+//
+// MCIMAPQuotaOperation.cc
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCIMAPQuotaOperation.h"
+
+#include "MCIMAPSession.h"
+#include "MCIMAPAsyncConnection.h"
+
+using namespace mailcore;
+
+IMAPQuotaOperation::IMAPQuotaOperation()
+{
+ mLimit = 0;
+ mUsage = 0;
+}
+
+IMAPQuotaOperation::~IMAPQuotaOperation()
+{
+}
+
+uint32_t IMAPQuotaOperation::limit()
+{
+ return mLimit;
+}
+
+uint32_t IMAPQuotaOperation::usage()
+{
+ return mUsage;
+}
+
+void IMAPQuotaOperation::main()
+{
+ ErrorCode error;
+ session()->session()->getQuota(&mUsage, &mLimit, &error);
+ setError(error);
+}
diff --git a/src/async/imap/MCIMAPQuotaOperation.h b/src/async/imap/MCIMAPQuotaOperation.h
new file mode 100644
index 00000000..5cef943c
--- /dev/null
+++ b/src/async/imap/MCIMAPQuotaOperation.h
@@ -0,0 +1,39 @@
+//
+// MCIMAPQuotaOperation.h
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCIMAPQuotaOperation_H_
+
+#define __MAILCORE_MCIMAPQuotaOperation_H_
+
+#include "MCIMAPOperation.h"
+
+#ifdef __cplusplus
+
+namespace mailcore {
+
+ class IMAPQuotaOperation : public IMAPOperation {
+ public:
+ IMAPQuotaOperation();
+ virtual ~IMAPQuotaOperation();
+
+ // Result.
+ virtual uint32_t limit();
+ virtual uint32_t usage();
+
+ public: // subclass behavior
+ virtual void main();
+
+ private:
+ uint32_t mLimit;
+ uint32_t mUsage;
+ };
+}
+
+#endif
+
+#endif
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc
index 7ebe4354..09f78ec1 100644..100755
--- a/src/core/imap/MCIMAPSession.cc
+++ b/src/core/imap/MCIMAPSession.cc
@@ -2471,6 +2471,41 @@ IndexSet * IMAPSession::search(String * folder, IMAPSearchExpression * expressio
return result;
}
+void IMAPSession::getQuota(uint32_t *usage, uint32_t *limit, ErrorCode * pError)
+{
+ static char * const inboxFolderName = "INBOX";
+ mailimap_quota_complete_data *quota_data;
+ selectIfNeeded(MCSTR("INBOX"), pError);
+
+ if (* pError != ErrorNone)
+ return;
+
+ int r = mailimap_quota_getquotaroot(mImap, inboxFolderName, &quota_data);
+ if (r == MAILIMAP_ERROR_STREAM) {
+ * pError = ErrorConnection;
+ return;
+ }
+ else if (r == MAILIMAP_ERROR_PARSE) {
+ * pError = ErrorParse;
+ return;
+ }
+ else if (hasError(r)) {
+ * pError = ErrorFetch;
+ return;
+ }
+ for(clistiter * cur = clist_begin(quota_data->quota_list); cur != NULL; cur = clist_next(cur)) {
+ mailimap_quota_quota_data *quota = (mailimap_quota_quota_data*)clist_content(cur);
+ for (clistiter *cur2 = clist_begin(quota->quota_list); cur2 != NULL; cur2 = clist_next(cur2)) {
+ mailimap_quota_quota_resource *res = (mailimap_quota_quota_resource*)clist_content(cur2);
+ if (!strcasecmp("STORAGE", res->resource_name)) {
+ *usage = res->usage;
+ *limit = res->limit;
+ }
+ }
+ }
+ mailimap_quota_complete_data_free(quota_data);
+}
+
bool IMAPSession::setupIdle()
{
// main thread
diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h
index 4128b516..97567d65 100644..100755
--- a/src/core/imap/MCIMAPSession.h
+++ b/src/core/imap/MCIMAPSession.h
@@ -126,6 +126,7 @@ namespace mailcore {
virtual IndexSet * search(String * folder, IMAPSearchKind kind, String * searchString, ErrorCode * pError);
virtual IndexSet * search(String * folder, IMAPSearchExpression * expression, ErrorCode * pError);
+ virtual void getQuota(uint32_t *usage, uint32_t *limit, ErrorCode * pError);
virtual bool setupIdle();
virtual void idle(String * folder, uint32_t lastKnownUID, ErrorCode * pError);
diff --git a/src/objc/imap/MCOIMAP.h b/src/objc/imap/MCOIMAP.h
index f0994042..e2036291 100644..100755
--- a/src/objc/imap/MCOIMAP.h
+++ b/src/objc/imap/MCOIMAP.h
@@ -36,6 +36,7 @@
#import <MailCore/MCOIMAPFetchNamespaceOperation.h>
#import <MailCore/MCOIMAPIdentityOperation.h>
#import <MailCore/MCOIMAPCapabilityOperation.h>
+#import <MailCore/MCOIMAPQuotaOperation.h>
#import <MailCore/MCOIMAPSearchExpression.h>
#import <MailCore/MCOIMAPMessageRenderingOperation.h>
diff --git a/src/objc/imap/MCOIMAPQuotaOperation.h b/src/objc/imap/MCOIMAPQuotaOperation.h
new file mode 100644
index 00000000..c0463bb0
--- /dev/null
+++ b/src/objc/imap/MCOIMAPQuotaOperation.h
@@ -0,0 +1,15 @@
+//
+// MCOIMAPQuotaOperation.h
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOIMAPBaseOperation.h"
+
+@interface MCOIMAPQuotaOperation : MCOIMAPBaseOperation
+
+- (void) start:(void (^)(NSError * error, NSUInteger usage, NSUInteger limit))completionBlock;
+
+@end
diff --git a/src/objc/imap/MCOIMAPQuotaOperation.mm b/src/objc/imap/MCOIMAPQuotaOperation.mm
new file mode 100644
index 00000000..5be2571f
--- /dev/null
+++ b/src/objc/imap/MCOIMAPQuotaOperation.mm
@@ -0,0 +1,69 @@
+//
+// MCOIMAPQuotaOperation.m
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOIMAPQuotaOperation.h"
+
+#include "MCAsyncIMAP.h"
+
+#import "MCOOperation+Private.h"
+#import "MCOUtils.h"
+
+typedef void (^CompletionType)(NSError *error, NSUInteger usage, NSUInteger limit);
+
+@implementation MCOIMAPQuotaOperation {
+ CompletionType _completionBlock;
+}
+
+#define nativeType mailcore::IMAPQuotaOperation
+
++ (void) load
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ nativeType * op = (nativeType *) object;
+ return [[[self alloc] initWithMCOperation:op] autorelease];
+}
+
+- (void) dealloc
+{
+ [_completionBlock release];
+ [super dealloc];
+}
+
+- (void) start:(void (^)(NSError *error, NSUInteger usage, NSUInteger limit))completionBlock
+{
+ _completionBlock = [completionBlock copy];
+ [self start];
+}
+
+- (void) cancel
+{
+ [_completionBlock release];
+ _completionBlock = nil;
+ [super cancel];
+}
+
+- (void) operationCompleted
+{
+ if (_completionBlock == NULL)
+ return;
+
+ nativeType *op = MCO_NATIVE_INSTANCE;
+ if (op->error() == mailcore::ErrorNone) {
+ _completionBlock(nil, op->usage(), op->limit());
+ } else {
+ _completionBlock([NSError mco_errorWithErrorCode:op->error()], 0, 0);
+ }
+ [_completionBlock release];
+ _completionBlock = nil;
+}
+
+@end
diff --git a/src/objc/imap/MCOIMAPSession.h b/src/objc/imap/MCOIMAPSession.h
index 5db608f7..ea920114 100644..100755
--- a/src/objc/imap/MCOIMAPSession.h
+++ b/src/objc/imap/MCOIMAPSession.h
@@ -29,6 +29,7 @@
@class MCOIMAPSearchExpression;
@class MCOIMAPIdentityOperation;
@class MCOIMAPCapabilityOperation;
+@class MCOIMAPQuotaOperation;
@class MCOIMAPMessageRenderingOperation;
@class MCOIMAPMessage;
@@ -507,6 +508,8 @@
*/
- (MCOIMAPCapabilityOperation *) capabilityOperation;
+- (MCOIMAPQuotaOperation *) quotaOperation;
+
/** @name Search Operations */
/**
diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm
index 2546e612..a9bbeb5c 100644..100755
--- a/src/objc/imap/MCOIMAPSession.mm
+++ b/src/objc/imap/MCOIMAPSession.mm
@@ -362,6 +362,12 @@ MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, ma
return MCO_TO_OBJC_OP(coreOp);
}
+- (MCOIMAPQuotaOperation *) quotaOperation
+{
+ IMAPQuotaOperation * coreOp = MCO_NATIVE_INSTANCE->quotaOperation();
+ return MCO_TO_OBJC_OP((IMAPOperation*)coreOp);
+}
+
- (void) _logWithSender:(void *)sender connectionType:(MCOConnectionLogType)logType data:(NSData *)data
{
_connectionLogger(sender, logType, data);