aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/rfc822
diff options
context:
space:
mode:
authorGravatar DINH Viet Hoa <dinh.viet.hoa@gmail.com>2013-03-23 16:27:20 -0700
committerGravatar DINH Viet Hoa <dinh.viet.hoa@gmail.com>2013-03-23 16:27:20 -0700
commitd9444ef87c866e3535562a693236b55d88379886 (patch)
treeabfef08ad60df8e84fa46549be7bdd10bb713c9a /src/objc/rfc822
parent77d8decc5071234189dc803d715015f0a93c7652 (diff)
Make IMAP ObjC bridge implementation consistent
Diffstat (limited to 'src/objc/rfc822')
-rw-r--r--src/objc/rfc822/MCOAttachment.h2
-rw-r--r--src/objc/rfc822/MCOAttachment.mm8
-rw-r--r--src/objc/rfc822/MCOMessageBuilder.mm8
-rw-r--r--src/objc/rfc822/MCOMessageParser.h2
-rw-r--r--src/objc/rfc822/MCOMessageParser.mm10
-rw-r--r--src/objc/rfc822/MCOMessagePart.mm8
-rw-r--r--src/objc/rfc822/MCOMultipart.mm8
7 files changed, 43 insertions, 3 deletions
diff --git a/src/objc/rfc822/MCOAttachment.h b/src/objc/rfc822/MCOAttachment.h
index fec04cc0..bb908501 100644
--- a/src/objc/rfc822/MCOAttachment.h
+++ b/src/objc/rfc822/MCOAttachment.h
@@ -20,7 +20,7 @@
+ (MCOAttachment *) attachmentWithRFC822Message:(NSData *)messageData;
+ (MCOAttachment *) attachmentWithText:(NSString *)text;
-@property (nonatomic, retain) NSData * data;
+@property (nonatomic, strong) NSData * data;
@end
diff --git a/src/objc/rfc822/MCOAttachment.mm b/src/objc/rfc822/MCOAttachment.mm
index d9906a10..d507ff50 100644
--- a/src/objc/rfc822/MCOAttachment.mm
+++ b/src/objc/rfc822/MCOAttachment.mm
@@ -26,6 +26,14 @@
MCORegisterClass(self, &typeid(nativeType));
}
+- (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];
+}
+
+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::Attachment * attachment = (mailcore::Attachment *) object;
diff --git a/src/objc/rfc822/MCOMessageBuilder.mm b/src/objc/rfc822/MCOMessageBuilder.mm
index d929e98a..b25bd3c4 100644
--- a/src/objc/rfc822/MCOMessageBuilder.mm
+++ b/src/objc/rfc822/MCOMessageBuilder.mm
@@ -22,6 +22,14 @@
MCORegisterClass(self, &typeid(nativeType));
}
+- (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];
+}
+
+ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::MessageBuilder * msg = (mailcore::MessageBuilder *) object;
diff --git a/src/objc/rfc822/MCOMessageParser.h b/src/objc/rfc822/MCOMessageParser.h
index fd1f5304..1bd2c14e 100644
--- a/src/objc/rfc822/MCOMessageParser.h
+++ b/src/objc/rfc822/MCOMessageParser.h
@@ -16,7 +16,7 @@
@interface MCOMessageParser : MCOAbstractMessage
-@property (nonatomic, assign) id <MCOHTMLRendererDelegate> rendererDelegate;
+@property (nonatomic, weak) id <MCOHTMLRendererDelegate> rendererDelegate;
+ (MCOMessageParser *) messageParserWithData:(NSData *)data;
diff --git a/src/objc/rfc822/MCOMessageParser.mm b/src/objc/rfc822/MCOMessageParser.mm
index 5ff3db13..c3951d1d 100644
--- a/src/objc/rfc822/MCOMessageParser.mm
+++ b/src/objc/rfc822/MCOMessageParser.mm
@@ -142,6 +142,14 @@ private:
MCORegisterClass(self, &typeid(nativeType));
}
+- (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];
+}
+
+ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::MessageParser * msg = (mailcore::MessageParser *) object;
@@ -158,7 +166,7 @@ private:
mailcore::MessageParser * message = new mailcore::MessageParser([data mco_mcData]);
self = [super initWithMCMessage:message];
_htmlRenderCallback = new MCOMessageParserRenderedCallback(self);
- message->release();
+ MC_SAFE_RELEASE(message);
return self;
}
diff --git a/src/objc/rfc822/MCOMessagePart.mm b/src/objc/rfc822/MCOMessagePart.mm
index 65e091dd..bb6c02cc 100644
--- a/src/objc/rfc822/MCOMessagePart.mm
+++ b/src/objc/rfc822/MCOMessagePart.mm
@@ -22,6 +22,14 @@
MCORegisterClass(self, &typeid(nativeType));
}
+- (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];
+}
+
+ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::MessagePart * part = (mailcore::MessagePart *) object;
diff --git a/src/objc/rfc822/MCOMultipart.mm b/src/objc/rfc822/MCOMultipart.mm
index a0266503..f81e0c8a 100644
--- a/src/objc/rfc822/MCOMultipart.mm
+++ b/src/objc/rfc822/MCOMultipart.mm
@@ -22,6 +22,14 @@
MCORegisterClass(self, &typeid(nativeType));
}
+- (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];
+}
+
+ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::Attachment * attachment = (mailcore::Attachment *) object;