diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2015-01-03 23:10:15 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2015-01-03 23:10:24 -0800 |
commit | da10b9124b52e34ac49edd1120bc04926e0a44e6 (patch) | |
tree | e0b788d613d7cac4408a983dfedd55721fbdc187 /src | |
parent | a54deab9ad377fb36b21ec1fd67a67cb71824ea9 (diff) |
Refactoring, fixed #1013
Diffstat (limited to 'src')
21 files changed, 311 insertions, 157 deletions
diff --git a/src/async/imap/MCAsyncIMAP.h b/src/async/imap/MCAsyncIMAP.h index 15c9e482..8a490aa8 100755 --- a/src/async/imap/MCAsyncIMAP.h +++ b/src/async/imap/MCAsyncIMAP.h @@ -19,6 +19,7 @@ #include <MailCore/MCIMAPFetchContentOperation.h> #include <MailCore/MCIMAPFetchParsedContentOperation.h> #include <MailCore/MCIMAPIdleOperation.h> +#include <MailCore/MCIMAPFolderInfo.h> #include <MailCore/MCIMAPFolderInfoOperation.h> #include <MailCore/MCIMAPFolderStatusOperation.h> #include <MailCore/MCIMAPSession.h> diff --git a/src/async/imap/MCIMAPAsyncSession.cpp b/src/async/imap/MCIMAPAsyncSession.cpp index f3a55a5e..d9fb38d5 100755 --- a/src/async/imap/MCIMAPAsyncSession.cpp +++ b/src/async/imap/MCIMAPAsyncSession.cpp @@ -485,8 +485,8 @@ IMAPFetchMessagesOperation * IMAPAsyncSession::fetchMessagesByNumberOperation(St return op; } -IMAPFetchMessagesOperation * IMAPAsyncSession::syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * uids, uint64_t modSeq) +IMAPFetchMessagesOperation * IMAPAsyncSession::syncMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind, + IndexSet * uids, uint64_t modSeq) { IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); op->setMainSession(this); diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h index 4a61393f..64258674 100755 --- a/src/async/imap/MCIMAPAsyncSession.h +++ b/src/async/imap/MCIMAPAsyncSession.h @@ -127,8 +127,8 @@ namespace mailcore { IndexSet * indexes); virtual IMAPFetchMessagesOperation * fetchMessagesByNumberOperation(String * folder, IMAPMessagesRequestKind requestKind, IndexSet * indexes); - virtual IMAPFetchMessagesOperation * syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * indexes, uint64_t modSeq); + virtual IMAPFetchMessagesOperation * syncMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind, + IndexSet * indexes, uint64_t modSeq); virtual IMAPFetchContentOperation * fetchMessageByUIDOperation(String * folder, uint32_t uid, bool urgent = false); virtual IMAPFetchContentOperation * fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID, diff --git a/src/async/imap/MCIMAPFolderInfo.cpp b/src/async/imap/MCIMAPFolderInfo.cpp new file mode 100644 index 00000000..2f790ca4 --- /dev/null +++ b/src/async/imap/MCIMAPFolderInfo.cpp @@ -0,0 +1,106 @@ +// +// MCIMAPFolderInfo.cpp +// mailcore2 +// +// Created by DINH Viêt Hoà on 12/6/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCIMAPFolderInfo.h" + +using namespace mailcore; + +void IMAPFolderInfo::init() +{ + mUidNext = 0; + mUidValidity = 0; + mMessageCount = 0; + mModSequenceValue = 0; + mFirstUnseenUid = 0; + mAllowsNewPermanentFlags = false; +} + +IMAPFolderInfo::IMAPFolderInfo() +{ + init(); +} + +IMAPFolderInfo::IMAPFolderInfo(IMAPFolderInfo * other) +{ + init(); + setUidNext(other->uidNext()); + setUidValidity(other->uidValidity()); + setModSequenceValue(other->modSequenceValue()); + setMessageCount(other->messageCount()); + setFirstUnseenUid(other->firstUnseenUid()); + setAllowsNewPermanentFlags(other->allowsNewPermanentFlags()); +} + +IMAPFolderInfo::~IMAPFolderInfo() +{ +} + +Object * IMAPFolderInfo::copy() +{ + return new IMAPFolderInfo(this); +} + +void IMAPFolderInfo::setUidNext(uint32_t uidNext) +{ + mUidNext = uidNext; +} + +uint32_t IMAPFolderInfo::uidNext() +{ + return mUidNext; +} + +void IMAPFolderInfo::setUidValidity(uint32_t uidValidity) +{ + mUidValidity = uidValidity; +} + +uint32_t IMAPFolderInfo::uidValidity() +{ + return mUidValidity; +} + +void IMAPFolderInfo::setModSequenceValue(uint64_t modSequenceValue) +{ + mModSequenceValue = modSequenceValue; +} + +uint64_t IMAPFolderInfo::modSequenceValue() +{ + return mModSequenceValue; +} + +void IMAPFolderInfo::setMessageCount(int messageCount) +{ + mMessageCount = messageCount; +} + +int IMAPFolderInfo::messageCount() +{ + return mMessageCount; +} + +void IMAPFolderInfo::setFirstUnseenUid(uint32_t firstUnseenUid) +{ + mFirstUnseenUid = firstUnseenUid; +} + +uint32_t IMAPFolderInfo::firstUnseenUid() +{ + return mFirstUnseenUid; +} + +void IMAPFolderInfo::setAllowsNewPermanentFlags(bool allowsNewPermanentFlags) +{ + mAllowsNewPermanentFlags = allowsNewPermanentFlags; +} + +bool IMAPFolderInfo::allowsNewPermanentFlags() +{ + return mAllowsNewPermanentFlags; +} diff --git a/src/async/imap/MCIMAPFolderInfo.h b/src/async/imap/MCIMAPFolderInfo.h new file mode 100644 index 00000000..c0fa7c35 --- /dev/null +++ b/src/async/imap/MCIMAPFolderInfo.h @@ -0,0 +1,63 @@ +// +// MCIMAPFolderInfo.h +// mailcore2 +// +// Created by DINH Viêt Hoà on 12/6/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCIMAPFolderInfo_H + +#define MAILCORE_MCIMAPFolderInfo_H + +#include <MailCore/MCBaseTypes.h> +#include <MailCore/MCMessageConstants.h> + +#ifdef __cplusplus + +namespace mailcore { + + class MAILCORE_EXPORT IMAPFolderInfo : public Object { + public: + IMAPFolderInfo(); + virtual ~IMAPFolderInfo(); + + virtual void setUidNext(uint32_t uidNext); + virtual uint32_t uidNext(); + + virtual void setUidValidity(uint32_t uidValidity); + virtual uint32_t uidValidity(); + + virtual void setModSequenceValue(uint64_t modSequenceValue); + virtual uint64_t modSequenceValue(); + + virtual void setMessageCount(int messageCount); + virtual int messageCount(); + + virtual void setFirstUnseenUid(uint32_t firstUnseenUid); + virtual uint32_t firstUnseenUid(); + + virtual void setAllowsNewPermanentFlags(bool allowsNewPermanentFlags); + virtual bool allowsNewPermanentFlags(); + + public: // subclass behavior + IMAPFolderInfo(IMAPFolderInfo * other); + virtual Object * copy(); + + private: + uint32_t mUidNext; + uint32_t mUidValidity; + uint64_t mModSequenceValue; + int mMessageCount; + uint32_t mFirstUnseenUid; + bool mAllowsNewPermanentFlags; + + void init(); + }; + +} + +#endif + +#endif + diff --git a/src/async/imap/MCIMAPFolderInfoOperation.cpp b/src/async/imap/MCIMAPFolderInfoOperation.cpp index 0ea0d005..fc4e4462 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.cpp +++ b/src/async/imap/MCIMAPFolderInfoOperation.cpp @@ -10,51 +10,23 @@ #include "MCIMAPSession.h" #include "MCIMAPAsyncConnection.h" +#include "MCIMAPFolderInfo.h" using namespace mailcore; IMAPFolderInfoOperation::IMAPFolderInfoOperation() { - mUidNext = 0; - mUidValidity = 0; - mMessageCount = 0; - mModSequenceValue = 0; - mFirstUnseenUid = 0; - mAllowsNewPermanentFlags = false; + mInfo = NULL; } IMAPFolderInfoOperation::~IMAPFolderInfoOperation() { + MC_SAFE_RELEASE(mInfo); } -uint32_t IMAPFolderInfoOperation::uidNext() +IMAPFolderInfo * IMAPFolderInfoOperation::info() { - return mUidNext; -} - -uint32_t IMAPFolderInfoOperation::uidValidity() -{ - return mUidValidity; -} - -uint64_t IMAPFolderInfoOperation::modSequenceValue() -{ - return mModSequenceValue; -} - -int IMAPFolderInfoOperation::messageCount() -{ - return mMessageCount; -} - -uint32_t IMAPFolderInfoOperation::firstUnseenUid() -{ - return mFirstUnseenUid; -} - -bool IMAPFolderInfoOperation::allowsNewPermanentFlags() -{ - return mAllowsNewPermanentFlags; + return mInfo; } void IMAPFolderInfoOperation::main() @@ -73,14 +45,14 @@ void IMAPFolderInfoOperation::main() return; } - - mUidNext = session()->session()->uidNext(); - mUidValidity = session()->session()->uidValidity(); - mModSequenceValue = session()->session()->modSequenceValue(); - mMessageCount = session()->session()->lastFolderMessageCount(); - mFirstUnseenUid = session()->session()->firstUnseenUid(); - mAllowsNewPermanentFlags = session()->session()->allowsNewPermanentFlags(); - + mInfo = new IMAPFolderInfo(); + mInfo->setUidNext(session()->session()->uidNext()); + mInfo->setUidValidity(session()->session()->uidValidity()); + mInfo->setModSequenceValue(session()->session()->modSequenceValue()); + mInfo->setMessageCount(session()->session()->lastFolderMessageCount()); + mInfo->setFirstUnseenUid(session()->session()->firstUnseenUid()); + mInfo->setAllowsNewPermanentFlags(session()->session()->allowsNewPermanentFlags()); + setError(error); } diff --git a/src/async/imap/MCIMAPFolderInfoOperation.h b/src/async/imap/MCIMAPFolderInfoOperation.h index b29f40a2..e0b5128c 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.h +++ b/src/async/imap/MCIMAPFolderInfoOperation.h @@ -15,31 +15,23 @@ #ifdef __cplusplus namespace mailcore { + + class IMAPFolderInfo; class MAILCORE_EXPORT IMAPFolderInfoOperation : public IMAPOperation { public: IMAPFolderInfoOperation(); virtual ~IMAPFolderInfoOperation(); - - virtual uint32_t uidNext(); - virtual uint32_t uidValidity(); - virtual uint64_t modSequenceValue(); - virtual int messageCount(); - virtual uint32_t firstUnseenUid(); - virtual bool allowsNewPermanentFlags(); - + + IMAPFolderInfo * info(); + public: // subclass behavior virtual void main(); private: - - uint32_t mUidNext; - uint32_t mUidValidity; - uint64_t mModSequenceValue; - int mMessageCount; - uint32_t mFirstUnseenUid; - bool mAllowsNewPermanentFlags; - + + IMAPFolderInfo * mInfo; + }; } diff --git a/src/cmake/async.cmake b/src/cmake/async.cmake index 2f6910f2..c1eb3faf 100644 --- a/src/cmake/async.cmake +++ b/src/cmake/async.cmake @@ -17,6 +17,7 @@ set(async_imap_files async/imap/MCIMAPFetchFoldersOperation.cpp async/imap/MCIMAPFetchMessagesOperation.cpp async/imap/MCIMAPFetchNamespaceOperation.cpp + async/imap/MCIMAPFolderInfo.cpp async/imap/MCIMAPFolderInfoOperation.cpp async/imap/MCIMAPFolderStatusOperation.cpp async/imap/MCIMAPIdentityOperation.cpp diff --git a/src/cmake/objc.cmake b/src/cmake/objc.cmake index 0de041e7..f67d76e4 100644 --- a/src/cmake/objc.cmake +++ b/src/cmake/objc.cmake @@ -21,7 +21,7 @@ set(objc_imap_files objc/imap/MCOIMAPFetchMessagesOperation.mm objc/imap/MCOIMAPFetchNamespaceOperation.mm objc/imap/MCOIMAPFolder.mm - objc/imap/MCOIMAPFolderInfo.m + objc/imap/MCOIMAPFolderInfo.mm objc/imap/MCOIMAPFolderInfoOperation.mm objc/imap/MCOIMAPFolderStatus.mm objc/imap/MCOIMAPFolderStatusOperation.mm diff --git a/src/core/basetypes/MCIndexSet.h b/src/core/basetypes/MCIndexSet.h index e76517db..2e2f4892 100644 --- a/src/core/basetypes/MCIndexSet.h +++ b/src/core/basetypes/MCIndexSet.h @@ -21,7 +21,7 @@ namespace mailcore { class MAILCORE_EXPORT IndexSet : public Object { public: IndexSet(); - IndexSet(IndexSet * o); + virtual ~IndexSet(); static IndexSet * indexSet(); static IndexSet * indexSetWithRange(Range range); @@ -45,7 +45,7 @@ namespace mailcore { virtual void removeAllIndexes(); public: // subclass behavior - virtual ~IndexSet(); + IndexSet(IndexSet * o); virtual String * description(); virtual Object * copy(); virtual HashMap * serializable(); diff --git a/src/core/basetypes/MCMainThreadAndroid.cpp b/src/core/basetypes/MCMainThreadAndroid.cpp index 36792cb1..cc41bb88 100644 --- a/src/core/basetypes/MCMainThreadAndroid.cpp +++ b/src/core/basetypes/MCMainThreadAndroid.cpp @@ -18,6 +18,7 @@ #include "MCAssert.h" #include "MCLog.h" #include "MCAutoreleasePool.h" +#include "TypesUtils.h" using namespace mailcore; @@ -53,6 +54,7 @@ JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_setupNative(JNIEnv * jclass localClass = env->FindClass("com/libmailcore/MainThreadUtils"); s_mainThreadUtilsClass = reinterpret_cast<jclass>(env->NewGlobalRef(localClass)); MCAssert(s_mainThreadUtilsClass != NULL); + MCTypesUtilsInit(); pool->release(); } @@ -101,10 +103,10 @@ void mailcore::callOnMainThreadAndWait(void (* function)(void *), void * context jmethodID mid = env->GetMethodID(s_mainThreadUtilsClass, "runOnMainThreadAndWait", "(J)V"); MCAssert(mid != NULL); env->CallVoidMethod(s_mainThreadUtils, mid, (jlong) data); - + // Wait. mailsem_down(data->sem); - + mailsem_free(data->sem); free(data); } diff --git a/src/core/basetypes/com_libmailcore_MainThreadUtils.h b/src/core/basetypes/com_libmailcore_MainThreadUtils.h deleted file mode 100644 index 327d9910..00000000 --- a/src/core/basetypes/com_libmailcore_MainThreadUtils.h +++ /dev/null @@ -1,37 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class com_libmailcore_MainThreadUtils */ - -#ifndef _Included_com_libmailcore_MainThreadUtils -#define _Included_com_libmailcore_MainThreadUtils -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_libmailcore_MainThreadUtils - * Method: setupNative - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_setupNative - (JNIEnv *, jobject); - -/* - * Class: com_libmailcore_MainThreadUtils - * Method: runIdentifier - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_runIdentifier - (JNIEnv *, jobject, jlong); - -/* - * Class: com_libmailcore_MainThreadUtils - * Method: runIdentifierAndNotify - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_runIdentifierAndNotify - (JNIEnv *, jobject, jlong); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/core/renderer/MCHTMLRendererCallback.cpp b/src/core/renderer/MCHTMLRendererCallback.cpp index edaf7e92..fb492c9e 100644 --- a/src/core/renderer/MCHTMLRendererCallback.cpp +++ b/src/core/renderer/MCHTMLRendererCallback.cpp @@ -15,6 +15,14 @@ using namespace mailcore; +HTMLRendererTemplateCallback::HTMLRendererTemplateCallback() +{ +} + +HTMLRendererTemplateCallback::~HTMLRendererTemplateCallback() +{ +} + mailcore::HashMap * HTMLRendererTemplateCallback::templateValuesForHeader(mailcore::MessageHeader * header) { mailcore::HashMap * result = mailcore::HashMap::hashMap(); diff --git a/src/core/renderer/MCHTMLRendererCallback.h b/src/core/renderer/MCHTMLRendererCallback.h index 7c20f18a..a12a3e45 100644 --- a/src/core/renderer/MCHTMLRendererCallback.h +++ b/src/core/renderer/MCHTMLRendererCallback.h @@ -24,14 +24,17 @@ namespace mailcore { public: HTMLRendererIMAPCallback() {} virtual ~HTMLRendererIMAPCallback() {} - + virtual Data * dataForIMAPPart(String * folder, IMAPPart * part) { return NULL; } virtual void prefetchAttachmentIMAPPart(String * folder, IMAPPart * part) {} virtual void prefetchImageIMAPPart(String * folder, IMAPPart * part) {} }; - + class MAILCORE_EXPORT HTMLRendererTemplateCallback { public: + HTMLRendererTemplateCallback(); + virtual ~HTMLRendererTemplateCallback(); + virtual bool canPreviewPart(AbstractPart * part); virtual bool shouldShowPart(AbstractPart * part); diff --git a/src/core/rfc822/MCMessageParser.cpp b/src/core/rfc822/MCMessageParser.cpp index 404bc862..71071c02 100644 --- a/src/core/rfc822/MCMessageParser.cpp +++ b/src/core/rfc822/MCMessageParser.cpp @@ -72,6 +72,11 @@ void MessageParser::setBytes(char * dataBytes, unsigned int dataLength) mailmessage_free(msg); } +MessageParser::MessageParser() +{ + init(); +} + MessageParser::MessageParser(Data * data) { init(); @@ -118,7 +123,9 @@ String * MessageParser::description() String * result = String::string(); result->appendUTF8Format("<%s:%p ", MCUTF8(className()), this); result->appendUTF8Format("<%p>", mMainPart); - result->appendString(mMainPart->description()); + if (mMainPart != NULL) { + result->appendString(mMainPart->description()); + } result->appendUTF8Characters(">"); return result; @@ -140,11 +147,17 @@ Object * MessageParser::copy() AbstractPart * MessageParser::partForContentID(String * contentID) { + if (mainPart() == NULL) { + return NULL; + } return mainPart()->partForContentID(contentID); } AbstractPart * MessageParser::partForUniqueID(String * uniqueID) { + if (mainPart() == NULL) { + return NULL; + } return mainPart()->partForUniqueID(uniqueID); } diff --git a/src/core/rfc822/MCMessageParser.h b/src/core/rfc822/MCMessageParser.h index 8d2fe4a6..048cee60 100644 --- a/src/core/rfc822/MCMessageParser.h +++ b/src/core/rfc822/MCMessageParser.h @@ -20,6 +20,7 @@ namespace mailcore { static MessageParser * messageParserWithData(Data * data); static MessageParser * messageParserWithContentsOfFile(String * filename); + MessageParser(); MessageParser(Data * data); virtual ~MessageParser(); diff --git a/src/objc/imap/MCOIMAPFolderInfo.h b/src/objc/imap/MCOIMAPFolderInfo.h index 53ad35b8..1397e841 100644 --- a/src/objc/imap/MCOIMAPFolderInfo.h +++ b/src/objc/imap/MCOIMAPFolderInfo.h @@ -14,10 +14,7 @@ /* This class holds IMAP folder metadata */ -@interface MCOIMAPFolderInfo : NSObject - -/** Create an empty instance */ -+ (MCOIMAPFolderInfo *) info; +@interface MCOIMAPFolderInfo : NSObject <NSCopying> /** The folder's IMAP UIDNEXT value. Used to determine the uid for the next received message. */ @property (nonatomic, assign) uint32_t uidNext; diff --git a/src/objc/imap/MCOIMAPFolderInfo.m b/src/objc/imap/MCOIMAPFolderInfo.m deleted file mode 100644 index be1d2c3e..00000000 --- a/src/objc/imap/MCOIMAPFolderInfo.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// MCOIMAPFolderInfo.m -// mailcore2 -// -// Created by DINH Viêt Hoà on 3/25/13. -// Copyright (c) 2013 MailCore. All rights reserved. -// - -#import "MCOIMAPFolderInfo.h" - -@implementation MCOIMAPFolderInfo { - uint32_t _uidNext; - uint32_t _uidValidity; - uint64_t _modSequenceValue; - int _messageCount; - uint32_t _firstUnseenUid; - BOOL _allowsNewPermanentFlags; -} - -@synthesize uidNext = _uidNext; -@synthesize uidValidity = _uidValidity; -@synthesize modSequenceValue = _modSequenceValue; -@synthesize messageCount = _messageCount; -@synthesize firstUnseenUid = _firstUnseenUid; -@synthesize allowsNewPermanentFlags = _allowsNewPermanentFlags; - -+ (MCOIMAPFolderInfo *) info -{ - return [[[MCOIMAPFolderInfo alloc] init] autorelease]; -} - -@end diff --git a/src/objc/imap/MCOIMAPFolderInfo.mm b/src/objc/imap/MCOIMAPFolderInfo.mm new file mode 100644 index 00000000..50c7f995 --- /dev/null +++ b/src/objc/imap/MCOIMAPFolderInfo.mm @@ -0,0 +1,72 @@ +// +// MCOIMAPFolderInfo.m +// mailcore2 +// +// Created by DINH Viêt Hoà on 3/25/13. +// Copyright (c) 2013 MailCore. All rights reserved. +// + +#import "MCOIMAPFolderInfo.h" +#import "NSObject+MCO.h" + +#include "MCIMAPFolderInfo.h" + +#define nativeType mailcore::IMAPFolderInfo + +@implementation MCOIMAPFolderInfo { + mailcore::IMAPFolderInfo * _nativeInfo; +} + ++ (void) load +{ + MCORegisterClass(self, &typeid(nativeType)); +} + +- (id) initWithMCFolderInfo:(mailcore::IMAPFolderInfo *)info +{ + self = [super init]; + + info->retain(); + _nativeInfo = info; + + return self; +} + +- (void) dealloc +{ + MC_SAFE_RELEASE(_nativeInfo); + [super dealloc]; +} + ++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object +{ + mailcore::IMAPFolderInfo * info = (mailcore::IMAPFolderInfo *) object; + return [[[self alloc] initWithMCFolderInfo:info] autorelease]; +} + +- (mailcore::Object *) mco_mcObject +{ + return _nativeInfo; +} + +- (id) copyWithZone:(NSZone *)zone +{ + nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); + id result = [[self class] mco_objectWithMCObject:nativeObject]; + MC_SAFE_RELEASE(nativeObject); + return [result retain]; +} + +- (NSString *) description +{ + return MCO_OBJC_BRIDGE_GET(description); +} + +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setUidNext, uidNext) +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setUidValidity, uidValidity) +MCO_OBJC_SYNTHESIZE_SCALAR(uint64_t, uint64_t, setModSequenceValue, modSequenceValue) +MCO_OBJC_SYNTHESIZE_SCALAR(int, int, setMessageCount, messageCount) +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setFirstUnseenUid, firstUnseenUid) +MCO_OBJC_SYNTHESIZE_SCALAR(BOOL, bool, setAllowsNewPermanentFlags, allowsNewPermanentFlags) + +@end diff --git a/src/objc/imap/MCOIMAPFolderInfoOperation.mm b/src/objc/imap/MCOIMAPFolderInfoOperation.mm index f4d322af..10c22462 100644 --- a/src/objc/imap/MCOIMAPFolderInfoOperation.mm +++ b/src/objc/imap/MCOIMAPFolderInfoOperation.mm @@ -56,20 +56,12 @@ typedef void (^CompletionType)(NSError *error, MCOIMAPFolderInfo *info); { if (_completionBlock == NULL) return; - + nativeType *op = MCO_NATIVE_INSTANCE; if (op->error() == mailcore::ErrorNone) { - MCOIMAPFolderInfo * info = [MCOIMAPFolderInfo info]; - [info setUidNext:MCO_NATIVE_INSTANCE->uidNext()]; - [info setUidValidity:MCO_NATIVE_INSTANCE->uidValidity()]; - [info setModSequenceValue:MCO_NATIVE_INSTANCE->modSequenceValue()]; - [info setMessageCount:MCO_NATIVE_INSTANCE->messageCount()]; - [info setFirstUnseenUid:MCO_NATIVE_INSTANCE->firstUnseenUid()]; - [info setAllowsNewPermanentFlags:MCO_NATIVE_INSTANCE->allowsNewPermanentFlags()]; - + MCOIMAPFolderInfo * info = MCO_TO_OBJC(op->info()); _completionBlock(nil, info); - } - else { + } else { _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); } [_completionBlock release]; diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm index 325beda7..97673518 100755 --- a/src/objc/imap/MCOIMAPSession.mm +++ b/src/objc/imap/MCOIMAPSession.mm @@ -321,10 +321,10 @@ MCO_OBJC_SYNTHESIZE_SCALAR(dispatch_queue_t, dispatch_queue_t, setDispatchQueue, uids:(MCOIndexSet *)uids modSeq:(uint64_t)modSeq { - IMAPFetchMessagesOperation * coreOp = MCO_NATIVE_INSTANCE->syncMessagesByUID([folder mco_mcString], - (IMAPMessagesRequestKind) requestKind, - MCO_FROM_OBJC(IndexSet, uids), - modSeq); + IMAPFetchMessagesOperation * coreOp = MCO_NATIVE_INSTANCE->syncMessagesByUIDOperation([folder mco_mcString], + (IMAPMessagesRequestKind) requestKind, + MCO_FROM_OBJC(IndexSet, uids), + modSeq); return MCO_TO_OBJC_OP(coreOp); } |