diff options
-rw-r--r-- | src/objc/abstract/MCOAbstractMessage.h | 2 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractMessage.mm | 28 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractMessagePart.h | 2 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractMessagePart.mm | 16 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractMultipart.h | 2 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractMultipart.mm | 14 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractPart.h | 2 | ||||
-rw-r--r-- | src/objc/abstract/MCOAbstractPart.mm | 40 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPMessage.h | 2 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPMessage.mm | 24 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPMessagePart.h | 2 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPMessagePart.mm | 14 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPMultipart.h | 2 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPMultipart.mm | 14 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPPart.h | 2 | ||||
-rw-r--r-- | src/objc/imap/MCOIMAPPart.mm | 18 |
16 files changed, 22 insertions, 162 deletions
diff --git a/src/objc/abstract/MCOAbstractMessage.h b/src/objc/abstract/MCOAbstractMessage.h index d60bfe8c..1e6dd2e6 100644 --- a/src/objc/abstract/MCOAbstractMessage.h +++ b/src/objc/abstract/MCOAbstractMessage.h @@ -15,7 +15,7 @@ @class MCOMessageHeader; @class MCOAbstractPart; -@interface MCOAbstractMessage : NSObject <NSCoding, NSCopying> +@interface MCOAbstractMessage : NSObject <NSCopying> /** Header of the message. */ @property (nonatomic, strong) MCOMessageHeader * header; diff --git a/src/objc/abstract/MCOAbstractMessage.mm b/src/objc/abstract/MCOAbstractMessage.mm index 83f19732..0affe783 100644 --- a/src/objc/abstract/MCOAbstractMessage.mm +++ b/src/objc/abstract/MCOAbstractMessage.mm @@ -38,30 +38,14 @@ return self; } -- (id) initWithCoder:(NSCoder *)decoder -{ - MCOAbstractMessage * abstractPart = [[[[self class] alloc] init] autorelease]; - mailcore::AbstractMessage * message = (mailcore::AbstractMessage *) [abstractPart mco_mcObject]; - message->setHeader((mailcore::MessageHeader *) [[decoder decodeObjectForKey:@"header"] mco_mcObject]); - - self = [self initWithMCMessage:message]; - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)encoder -{ - [encoder encodeObject:[self header] forKey:@"header"]; -} - - (id) copyWithZone:(NSZone *)zone { - MCOAbstractMessage *message; - - message = [[[self class] alloc] initWithMCMessage:(mailcore::AbstractMessage *)_message->copy()->autorelease()]; - [message setHeader:[[[self header] copy] autorelease]]; - - return message; + MCOAbstractMessage *message; + + message = [[[self class] alloc] initWithMCMessage:(mailcore::AbstractMessage *)_message->copy()->autorelease()]; + [message setHeader:[[[self header] copy] autorelease]]; + + return message; } - (void) dealloc diff --git a/src/objc/abstract/MCOAbstractMessagePart.h b/src/objc/abstract/MCOAbstractMessagePart.h index d69b6012..69a6a8f8 100644 --- a/src/objc/abstract/MCOAbstractMessagePart.h +++ b/src/objc/abstract/MCOAbstractMessagePart.h @@ -15,7 +15,7 @@ @class MCOMessageHeader; -@interface MCOAbstractMessagePart : MCOAbstractPart <NSCoding> +@interface MCOAbstractMessagePart : MCOAbstractPart // Returns the header of the embedded message. @property (nonatomic, strong) MCOMessageHeader * header; diff --git a/src/objc/abstract/MCOAbstractMessagePart.mm b/src/objc/abstract/MCOAbstractMessagePart.mm index 55a0a828..7d66a355 100644 --- a/src/objc/abstract/MCOAbstractMessagePart.mm +++ b/src/objc/abstract/MCOAbstractMessagePart.mm @@ -18,22 +18,6 @@ #define nativeType mailcore::AbstractMessagePart -- (id) initWithCoder:(NSCoder *)decoder -{ - self = [super init]; - - [self setHeader:[decoder decodeObjectForKey:@"header"]]; - [self setMainPart:[decoder decodeObjectForKey:@"mainPart"]]; - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)encoder -{ - [encoder encodeObject:[self header] forKey:@"header"]; - [encoder encodeObject:[self mainPart] forKey:@"mainPart"]; -} - MCO_OBJC_SYNTHESIZE(MessageHeader, setHeader, header) MCO_OBJC_SYNTHESIZE(AbstractMessagePart, setMainPart, mainPart) diff --git a/src/objc/abstract/MCOAbstractMultipart.h b/src/objc/abstract/MCOAbstractMultipart.h index b3b202db..e43a3e41 100644 --- a/src/objc/abstract/MCOAbstractMultipart.h +++ b/src/objc/abstract/MCOAbstractMultipart.h @@ -13,7 +13,7 @@ #import <Foundation/Foundation.h> #import <MailCore/MCOAbstractPart.h> -@interface MCOAbstractMultipart : MCOAbstractPart <NSCoding> +@interface MCOAbstractMultipart : MCOAbstractPart /** Returns the subparts of that multipart.*/ @property (nonatomic, copy) NSArray * /* MCOAbstractPart */ parts; diff --git a/src/objc/abstract/MCOAbstractMultipart.mm b/src/objc/abstract/MCOAbstractMultipart.mm index a644a15f..25e633cd 100644 --- a/src/objc/abstract/MCOAbstractMultipart.mm +++ b/src/objc/abstract/MCOAbstractMultipart.mm @@ -16,20 +16,6 @@ #define nativeType mailcore::AbstractMultipart -- (id) initWithCoder:(NSCoder *)decoder -{ - self = [super initWithCoder:decoder]; - - [self setParts:[decoder decodeObjectForKey:@"parts"]]; - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)encoder -{ - [encoder encodeObject:[self parts] forKey:@"parts"]; -} - MCO_OBJC_SYNTHESIZE_ARRAY(setParts, parts) @end diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h index 0703a783..07e44920 100644 --- a/src/objc/abstract/MCOAbstractPart.h +++ b/src/objc/abstract/MCOAbstractPart.h @@ -37,7 +37,7 @@ typedef enum { MCOPartTypeMultipartAlternative, } MCOPartType; -@interface MCOAbstractPart : NSObject <NSCoding> +@interface MCOAbstractPart : NSObject <NSCopying> /** Returns type of the part (single / message part / multipart/mixed, multipart/related, multipart/alternative). See MCOPartType.*/ diff --git a/src/objc/abstract/MCOAbstractPart.mm b/src/objc/abstract/MCOAbstractPart.mm index 5b108663..a6996a91 100644 --- a/src/objc/abstract/MCOAbstractPart.mm +++ b/src/objc/abstract/MCOAbstractPart.mm @@ -37,44 +37,20 @@ return self; } -- (id) initWithCoder:(NSCoder *)decoder -{ - MCOAbstractPart *abstractPart = [[[[self class] alloc] init] autorelease]; - mailcore::AbstractPart * part = (mailcore::AbstractPart *) [abstractPart mco_mcObject]; - part->setPartType((mailcore::PartType)[decoder decodeIntForKey:@"partType"]); - part->setFilename([[decoder decodeObjectForKey:@"filename"] mco_mcString]); - part->setMimeType([[decoder decodeObjectForKey:@"mimeType"] mco_mcString]); - part->setCharset([[decoder decodeObjectForKey:@"charset"] mco_mcString]); - part->setUniqueID([[decoder decodeObjectForKey:@"uniqueID"] mco_mcString]); - part->setContentID([[decoder decodeObjectForKey:@"contentID"] mco_mcString]); - part->setContentLocation([[decoder decodeObjectForKey:@"contentLocation"] mco_mcString]); - part->setInlineAttachment([decoder decodeBoolForKey:@"inlineAttachment"]); - - self = [self initWithMCPart:part]; - - part->release(); - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)encoder -{ - [encoder encodeInt:[self partType] forKey:@"partType"]; - [encoder encodeObject:[self filename] forKey:@"filename"]; - [encoder encodeObject:[self mimeType] forKey:@"mimeType"]; - [encoder encodeObject:[self charset] forKey:@"charset"]; - [encoder encodeObject:[self uniqueID] forKey:@"uniqueID"]; - [encoder encodeObject:[self contentID] forKey:@"contentID"]; - [encoder encodeObject:[self contentLocation] forKey:@"contentLocation"]; - [encoder encodeBool:[self isInlineAttachment] forKey:@"inlineAttachment"]; -} - - (void) dealloc { _part->release(); [super dealloc]; } +- (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); diff --git a/src/objc/imap/MCOIMAPMessage.h b/src/objc/imap/MCOIMAPMessage.h index 8baae3e9..06e437d8 100644 --- a/src/objc/imap/MCOIMAPMessage.h +++ b/src/objc/imap/MCOIMAPMessage.h @@ -29,7 +29,7 @@ @protocol MCOHTMLRendererIMAPDelegate; -@interface MCOIMAPMessage : MCOAbstractMessage <NSCoding, NSCopying> +@interface MCOIMAPMessage : MCOAbstractMessage <NSCopying> /** IMAP UID of the message. */ @property (nonatomic, assign) uint32_t uid; diff --git a/src/objc/imap/MCOIMAPMessage.mm b/src/objc/imap/MCOIMAPMessage.mm index 1d31f7b5..c9bfcbb9 100644 --- a/src/objc/imap/MCOIMAPMessage.mm +++ b/src/objc/imap/MCOIMAPMessage.mm @@ -27,30 +27,6 @@ MCORegisterClass(self, &typeid(nativeType)); } -- (id) initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - - [self setUid:[aDecoder decodeInt32ForKey:@"uid"]]; - [self setFlags:(MCOMessageFlag)[aDecoder decodeIntForKey:@"flags"]]; - [self setOriginalFlags:(MCOMessageFlag)[aDecoder decodeIntForKey:@"originalFlags"]]; - [self setModSeqValue:[aDecoder decodeInt64ForKey:@"modSeqValue"]]; - [self setMainPart:[aDecoder decodeObjectForKey:@"mainPart"]]; - [self setGmailLabels:[aDecoder decodeObjectForKey:@"gmailLabels"]]; - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeInt32:[self uid] forKey:@"uid"]; - [aCoder encodeInt:[self flags] forKey:@"flags"]; - [aCoder encodeInt:[self originalFlags] forKey:@"originalFlags"]; - [aCoder encodeInt64:[self modSeqValue] forKey:@"modSeqValue"]; - [aCoder encodeObject:[self mainPart] forKey:@"mainPart"]; - [aCoder encodeObject:[self gmailLabels] forKey:@"gmailLabels"]; -} - - (id) copyWithZone:(NSZone *)zone { nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); diff --git a/src/objc/imap/MCOIMAPMessagePart.h b/src/objc/imap/MCOIMAPMessagePart.h index c40c2673..b602d93a 100644 --- a/src/objc/imap/MCOIMAPMessagePart.h +++ b/src/objc/imap/MCOIMAPMessagePart.h @@ -14,7 +14,7 @@ #import <MailCore/MCOAbstractMessagePart.h> -@interface MCOIMAPMessagePart : MCOAbstractMessagePart <NSCoding, NSCopying> +@interface MCOIMAPMessagePart : MCOAbstractMessagePart <NSCopying> /** A part identifier is of the form 1.2.1*/ @property (nonatomic, copy) NSString * partID; diff --git a/src/objc/imap/MCOIMAPMessagePart.mm b/src/objc/imap/MCOIMAPMessagePart.mm index 35c13162..827636b3 100644 --- a/src/objc/imap/MCOIMAPMessagePart.mm +++ b/src/objc/imap/MCOIMAPMessagePart.mm @@ -22,14 +22,6 @@ MCORegisterClass(self, &typeid(nativeType)); } -- (id) initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - - [self setPartID:[aDecoder decodeObjectForKey:@"partID"]]; - - return self; -} - - (id) copyWithZone:(NSZone *)zone { nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); @@ -38,12 +30,6 @@ return [result retain]; } -- (void) encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:[self partID] forKey:@"partID"]; -} - + (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object { mailcore::IMAPMessagePart * part = (mailcore::IMAPMessagePart *) object; diff --git a/src/objc/imap/MCOIMAPMultipart.h b/src/objc/imap/MCOIMAPMultipart.h index d6eb55cb..0e0bb0eb 100644 --- a/src/objc/imap/MCOIMAPMultipart.h +++ b/src/objc/imap/MCOIMAPMultipart.h @@ -14,7 +14,7 @@ #import <MailCore/MCOAbstractMultipart.h> -@interface MCOIMAPMultipart : MCOAbstractMultipart <NSCoding, NSCopying> +@interface MCOIMAPMultipart : MCOAbstractMultipart <NSCopying> /** A part identifier looks like 1.2.1 */ @property (nonatomic, copy) NSString * partID; diff --git a/src/objc/imap/MCOIMAPMultipart.mm b/src/objc/imap/MCOIMAPMultipart.mm index 1cc60e05..fdfe4e7a 100644 --- a/src/objc/imap/MCOIMAPMultipart.mm +++ b/src/objc/imap/MCOIMAPMultipart.mm @@ -22,20 +22,6 @@ MCORegisterClass(self, &typeid(nativeType)); } -- (id) initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - - [self setPartID:[aDecoder decodeObjectForKey:@"partID"]]; - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:[self partID] forKey:@"partID"]; -} - - (id) copyWithZone:(NSZone *)zone { nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); diff --git a/src/objc/imap/MCOIMAPPart.h b/src/objc/imap/MCOIMAPPart.h index bf897f2f..029135bf 100644 --- a/src/objc/imap/MCOIMAPPart.h +++ b/src/objc/imap/MCOIMAPPart.h @@ -16,7 +16,7 @@ /** Represents a single IMAP message part */ -@interface MCOIMAPPart : MCOAbstractPart <NSCoding, NSCopying> +@interface MCOIMAPPart : MCOAbstractPart <NSCopying> /** A part identifier looks like 1.2.1 */ @property (nonatomic, copy) NSString * partID; diff --git a/src/objc/imap/MCOIMAPPart.mm b/src/objc/imap/MCOIMAPPart.mm index 26d5a961..80b86d23 100644 --- a/src/objc/imap/MCOIMAPPart.mm +++ b/src/objc/imap/MCOIMAPPart.mm @@ -22,24 +22,6 @@ MCORegisterClass(self, &typeid(nativeType)); } -- (id) initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - - [self setPartID:[aDecoder decodeObjectForKey:@"partID"]]; - [self setSize:(unsigned int) [aDecoder decodeIntForKey:@"size"]]; - [self setEncoding:(MCOEncoding) [aDecoder decodeIntForKey:@"encoding"]]; - - return self; -} - -- (void) encodeWithCoder:(NSCoder *)aCoder -{ - [super encodeWithCoder:aCoder]; - [aCoder encodeObject:[self partID] forKey:@"partID"]; - [aCoder encodeInt:[self size] forKey:@"size"]; - [aCoder encodeInt:[self encoding] forKey:@"encoding"]; -} - - (id) copyWithZone:(NSZone *)zone { nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); |