diff options
-rw-r--r-- | example/ios/iOS UI Test/iOS UI Test/MasterViewController.m | 11 | ||||
-rwxr-xr-x | scripts/prepare-libetpan-ios.sh | 2 | ||||
-rwxr-xr-x | scripts/prepare-libetpan-macos.sh | 2 | ||||
-rw-r--r-- | src/async/imap/MCIMAPAsyncConnection.cc | 2 | ||||
-rw-r--r-- | src/async/imap/MCIMAPIdleOperation.cc | 4 | ||||
-rw-r--r-- | src/async/pop/MCPOPAsyncSession.cc | 2 | ||||
-rw-r--r-- | src/async/smtp/MCSMTPAsyncSession.cc | 2 | ||||
-rw-r--r-- | src/core/basetypes/MCConnectionLogger.h | 1 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractMessage.mm | 8 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractPart.mm | 8 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPSession.mm | 2 | ||||
-rw-r--r-- | src/objc/pop/MCOPOPSession.mm | 2 | ||||
-rw-r--r-- | src/objc/smtp/MCOSMTPSendOperation.mm | 12 | ||||
-rw-r--r-- | src/objc/smtp/MCOSMTPSession.mm | 2 |
14 files changed, 45 insertions, 15 deletions
diff --git a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m index c9866ff8..3e5e4422 100644 --- a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m +++ b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m @@ -45,9 +45,16 @@ self.imapSession.username = username; self.imapSession.password = password; self.imapSession.connectionType = MCOConnectionTypeTLS; - + MasterViewController * __weak weakSelf = self; + self.imapSession.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) { + @synchronized(weakSelf) { + if (type != MCOConnectionLogTypeSentPrivate) { + NSLog(@"event logged:%p %i withData: %@", connectionID, type, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]); + } + } + }; + NSLog(@"checking account"); - __weak MasterViewController *weakSelf = self; self.imapCheckOp = [self.imapSession checkAccountOperation]; [self.imapCheckOp start:^(NSError *error) { MasterViewController *strongSelf = weakSelf; diff --git a/scripts/prepare-libetpan-ios.sh b/scripts/prepare-libetpan-ios.sh index 7a5a054b..ea109b5d 100755 --- a/scripts/prepare-libetpan-ios.sh +++ b/scripts/prepare-libetpan-ios.sh @@ -2,7 +2,7 @@ sdkversion=6.1 url="https://github.com/dinhviethoa/libetpan.git" -rev=78427a0506be00e1e72ac8f88aa4b71bebd4137f +rev=517a7fb7c47d925f67cc48ddf9636170c74ecd9e pushd `dirname $0` > /dev/null scriptpath=`pwd` diff --git a/scripts/prepare-libetpan-macos.sh b/scripts/prepare-libetpan-macos.sh index 81013fa6..c8eaf26b 100755 --- a/scripts/prepare-libetpan-macos.sh +++ b/scripts/prepare-libetpan-macos.sh @@ -1,7 +1,7 @@ #!/bin/sh url="https://github.com/dinhviethoa/libetpan.git" -rev=78427a0506be00e1e72ac8f88aa4b71bebd4137f +rev=517a7fb7c47d925f67cc48ddf9636170c74ecd9e pushd `dirname $0` > /dev/null scriptpath=`pwd` diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc index fc1935b7..1d07f79a 100644 --- a/src/async/imap/MCIMAPAsyncConnection.cc +++ b/src/async/imap/MCIMAPAsyncConnection.cc @@ -69,7 +69,7 @@ namespace mailcore { virtual ~IMAPConnectionLogger() { } - virtual void log(void * context, void * sender, ConnectionLogType logType, Data * buffer) + virtual void log(void * sender, ConnectionLogType logType, Data * buffer) { mConnection->logConnection(logType, buffer); } diff --git a/src/async/imap/MCIMAPIdleOperation.cc b/src/async/imap/MCIMAPIdleOperation.cc index 42c58f90..8b48b77c 100644 --- a/src/async/imap/MCIMAPIdleOperation.cc +++ b/src/async/imap/MCIMAPIdleOperation.cc @@ -47,7 +47,7 @@ void IMAPIdleOperation::unprepare() void IMAPIdleOperation::main() { - performMethodOnMainThread((Object::Method) &IMAPIdleOperation::prepare, NULL); + performMethodOnMainThread((Object::Method) &IMAPIdleOperation::prepare, NULL, true); if (!mSetupSuccess) { return; @@ -57,7 +57,7 @@ void IMAPIdleOperation::main() session()->session()->idle(folder(), mLastKnownUid, &error); setError(error); - performMethodOnMainThread((Object::Method) &IMAPIdleOperation::unprepare, NULL); + performMethodOnMainThread((Object::Method) &IMAPIdleOperation::unprepare, NULL, true); } void IMAPIdleOperation::interruptIdle() diff --git a/src/async/pop/MCPOPAsyncSession.cc b/src/async/pop/MCPOPAsyncSession.cc index 342b0f5e..bfabc847 100644 --- a/src/async/pop/MCPOPAsyncSession.cc +++ b/src/async/pop/MCPOPAsyncSession.cc @@ -50,7 +50,7 @@ namespace mailcore { virtual ~POPConnectionLogger() { } - virtual void log(void * context, void * sender, ConnectionLogType logType, Data * buffer) + virtual void log(void * sender, ConnectionLogType logType, Data * buffer) { mSession->logConnection(logType, buffer); } diff --git a/src/async/smtp/MCSMTPAsyncSession.cc b/src/async/smtp/MCSMTPAsyncSession.cc index fafc2e82..38d57756 100644 --- a/src/async/smtp/MCSMTPAsyncSession.cc +++ b/src/async/smtp/MCSMTPAsyncSession.cc @@ -41,7 +41,7 @@ namespace mailcore { virtual ~SMTPConnectionLogger() { } - virtual void log(void * context, void * sender, ConnectionLogType logType, Data * buffer) + virtual void log(void * sender, ConnectionLogType logType, Data * buffer) { mSession->logConnection(logType, buffer); } diff --git a/src/core/basetypes/MCConnectionLogger.h b/src/core/basetypes/MCConnectionLogger.h index dd596857..bdb588bc 100644 --- a/src/core/basetypes/MCConnectionLogger.h +++ b/src/core/basetypes/MCConnectionLogger.h @@ -16,7 +16,6 @@ namespace mailcore { class Data; - class String; enum ConnectionLogType { // Received data diff --git a/src/objc/abstract/MCOAbstractMessage.mm b/src/objc/abstract/MCOAbstractMessage.mm index 6fedcc8a..05530845 100644 --- a/src/objc/abstract/MCOAbstractMessage.mm +++ b/src/objc/abstract/MCOAbstractMessage.mm @@ -28,6 +28,12 @@ return _message; } +- (id) init +{ + MCAssert(0); + return nil; +} + - (id) initWithMCMessage:(mailcore::AbstractMessage *)message { self = [super init]; @@ -40,7 +46,7 @@ - (void) dealloc { - _message->release(); + MC_SAFE_RELEASE(_message); [super dealloc]; } diff --git a/src/objc/abstract/MCOAbstractPart.mm b/src/objc/abstract/MCOAbstractPart.mm index 8b2b008d..7a37dcaf 100644 --- a/src/objc/abstract/MCOAbstractPart.mm +++ b/src/objc/abstract/MCOAbstractPart.mm @@ -27,6 +27,12 @@ return _part; } +- (id) init +{ + MCAssert(0); + return nil; +} + - (id) initWithMCPart:(mailcore::AbstractPart *)part { self = [super init]; @@ -39,7 +45,7 @@ - (void) dealloc { - _part->release(); + MC_SAFE_RELEASE(_part); [super dealloc]; } diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm index 43f366e6..0c23f1e2 100644 --- a/src/objc/imap/MCOIMAPSession.mm +++ b/src/objc/imap/MCOIMAPSession.mm @@ -35,7 +35,7 @@ public: mSession = session; } - virtual void log(void * context, void * sender, ConnectionLogType logType, Data * data) + virtual void log(void * sender, ConnectionLogType logType, Data * data) { [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; } diff --git a/src/objc/pop/MCOPOPSession.mm b/src/objc/pop/MCOPOPSession.mm index 42c76646..fb48cb1e 100644 --- a/src/objc/pop/MCOPOPSession.mm +++ b/src/objc/pop/MCOPOPSession.mm @@ -31,7 +31,7 @@ public: mSession = session; } - virtual void log(void * context, void * sender, ConnectionLogType logType, Data * data) + virtual void log(void * sender, ConnectionLogType logType, Data * data) { [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; } diff --git a/src/objc/smtp/MCOSMTPSendOperation.mm b/src/objc/smtp/MCOSMTPSendOperation.mm index 776f7270..8a7d5b04 100644 --- a/src/objc/smtp/MCOSMTPSendOperation.mm +++ b/src/objc/smtp/MCOSMTPSendOperation.mm @@ -80,6 +80,18 @@ private: [self start]; } +// This method needs to be duplicated from MCOSMTPOperation since _completionBlock +// references the instance of this subclass and not the one from MCOSMTPOperation. +- (void)operationCompleted { + if (_completionBlock == NULL) + return; + + NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()]; + _completionBlock(error); + [_completionBlock release]; + _completionBlock = NULL; +} + - (void) bodyProgress:(unsigned int)current maximum:(unsigned int)maximum { if (_progress != NULL) { diff --git a/src/objc/smtp/MCOSMTPSession.mm b/src/objc/smtp/MCOSMTPSession.mm index 1538d53a..1cadf4ad 100644 --- a/src/objc/smtp/MCOSMTPSession.mm +++ b/src/objc/smtp/MCOSMTPSession.mm @@ -32,7 +32,7 @@ public: mSession = session; } - virtual void log(void * context, void * sender, ConnectionLogType logType, Data * data) + virtual void log(void * sender, ConnectionLogType logType, Data * data) { [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; } |