aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/objc/abstract/MCOAbstractMessage.h2
-rw-r--r--src/objc/abstract/MCOAbstractMessage.mm8
-rw-r--r--src/objc/abstract/MCOAbstractPart.h2
-rw-r--r--src/objc/abstract/MCOAbstractPart.mm8
-rw-r--r--src/objc/imap/MCOIMAPMessage.h2
-rw-r--r--src/objc/imap/MCOIMAPMessage.mm8
-rw-r--r--src/objc/imap/MCOIMAPMessagePart.h2
-rw-r--r--src/objc/imap/MCOIMAPMessagePart.mm8
-rw-r--r--src/objc/imap/MCOIMAPMultipart.h2
-rw-r--r--src/objc/imap/MCOIMAPMultipart.mm8
-rw-r--r--src/objc/imap/MCOIMAPPart.h2
-rw-r--r--src/objc/imap/MCOIMAPPart.mm8
-rw-r--r--src/objc/provider/MCONetService.h2
-rw-r--r--src/objc/provider/MCONetService.mm64
-rw-r--r--src/objc/rfc822/MCOAttachment.h2
-rw-r--r--src/objc/rfc822/MCOAttachment.mm8
-rw-r--r--src/objc/rfc822/MCOMessageParser.h2
-rw-r--r--src/objc/rfc822/MCOMessageParser.mm8
-rw-r--r--src/objc/rfc822/MCOMessagePart.mm8
-rw-r--r--src/objc/rfc822/MCOMultipart.h2
-rw-r--r--src/objc/rfc822/MCOMultipart.mm8
21 files changed, 62 insertions, 102 deletions
diff --git a/src/objc/abstract/MCOAbstractMessage.h b/src/objc/abstract/MCOAbstractMessage.h
index bf442659..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
+@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 05530845..637d6172 100644
--- a/src/objc/abstract/MCOAbstractMessage.mm
+++ b/src/objc/abstract/MCOAbstractMessage.mm
@@ -44,6 +44,14 @@
return self;
}
+- (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];
+}
+
- (void) dealloc
{
MC_SAFE_RELEASE(_message);
diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h
index a3ab44f6..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
+@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 7a37dcaf..459ae8be 100644
--- a/src/objc/abstract/MCOAbstractPart.mm
+++ b/src/objc/abstract/MCOAbstractPart.mm
@@ -49,6 +49,14 @@
[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 06e437d8..7de1fd69 100644
--- a/src/objc/imap/MCOIMAPMessage.h
+++ b/src/objc/imap/MCOIMAPMessage.h
@@ -29,7 +29,7 @@
@protocol MCOHTMLRendererIMAPDelegate;
-@interface MCOIMAPMessage : MCOAbstractMessage <NSCopying>
+@interface MCOIMAPMessage : MCOAbstractMessage
/** 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 c9bfcbb9..2dc71217 100644
--- a/src/objc/imap/MCOIMAPMessage.mm
+++ b/src/objc/imap/MCOIMAPMessage.mm
@@ -27,14 +27,6 @@
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::IMAPMessage * msg = (mailcore::IMAPMessage *) object;
diff --git a/src/objc/imap/MCOIMAPMessagePart.h b/src/objc/imap/MCOIMAPMessagePart.h
index b602d93a..1e2be559 100644
--- a/src/objc/imap/MCOIMAPMessagePart.h
+++ b/src/objc/imap/MCOIMAPMessagePart.h
@@ -14,7 +14,7 @@
#import <MailCore/MCOAbstractMessagePart.h>
-@interface MCOIMAPMessagePart : MCOAbstractMessagePart <NSCopying>
+@interface MCOIMAPMessagePart : MCOAbstractMessagePart
/** 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 827636b3..05a7e102 100644
--- a/src/objc/imap/MCOIMAPMessagePart.mm
+++ b/src/objc/imap/MCOIMAPMessagePart.mm
@@ -22,14 +22,6 @@
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::IMAPMessagePart * part = (mailcore::IMAPMessagePart *) object;
diff --git a/src/objc/imap/MCOIMAPMultipart.h b/src/objc/imap/MCOIMAPMultipart.h
index 0e0bb0eb..408b6593 100644
--- a/src/objc/imap/MCOIMAPMultipart.h
+++ b/src/objc/imap/MCOIMAPMultipart.h
@@ -14,7 +14,7 @@
#import <MailCore/MCOAbstractMultipart.h>
-@interface MCOIMAPMultipart : MCOAbstractMultipart <NSCopying>
+@interface MCOIMAPMultipart : MCOAbstractMultipart
/** 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 fdfe4e7a..c3761ade 100644
--- a/src/objc/imap/MCOIMAPMultipart.mm
+++ b/src/objc/imap/MCOIMAPMultipart.mm
@@ -22,14 +22,6 @@
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::IMAPMultipart * part = (mailcore::IMAPMultipart *) object;
diff --git a/src/objc/imap/MCOIMAPPart.h b/src/objc/imap/MCOIMAPPart.h
index 029135bf..f7bec632 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 <NSCopying>
+@interface MCOIMAPPart : MCOAbstractPart
/** 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 80b86d23..80fc2f1e 100644
--- a/src/objc/imap/MCOIMAPPart.mm
+++ b/src/objc/imap/MCOIMAPPart.mm
@@ -22,14 +22,6 @@
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::IMAPPart * part = (mailcore::IMAPPart *) object;
diff --git a/src/objc/provider/MCONetService.h b/src/objc/provider/MCONetService.h
index 482ae4dc..eb198e5e 100644
--- a/src/objc/provider/MCONetService.h
+++ b/src/objc/provider/MCONetService.h
@@ -13,7 +13,7 @@
This class provides a specific way to access a given service
*/
-@interface MCONetService : NSObject
+@interface MCONetService : NSObject <NSCopying>
/**
The hostname of the server. [MCONetService hostnameWithEmail:] is recommended
diff --git a/src/objc/provider/MCONetService.mm b/src/objc/provider/MCONetService.mm
index 0a2c0c33..260cb45f 100644
--- a/src/objc/provider/MCONetService.mm
+++ b/src/objc/provider/MCONetService.mm
@@ -14,50 +14,58 @@
#import "NSObject+MCO.h"
@implementation MCONetService {
- mailcore::NetService *_netService;
+ mailcore::NetService *_netService;
}
#define nativeType mailcore::NetService
+ (void) load
{
- MCORegisterClass( self, &typeid(nativeType) );
+ MCORegisterClass( self, &typeid(nativeType) );
}
- (mailcore::Object *) mco_mcObject
{
- return _netService;
+ return _netService;
}
+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
{
- mailcore::NetService *netService = (mailcore::NetService *)object;
- return [[self alloc] initWithNetService:netService];
+ mailcore::NetService *netService = (mailcore::NetService *)object;
+ return [[[self alloc] initWithNetService:netService] autorelease];
}
+ (MCONetService *) serviceWithInfo:(NSDictionary *)info
{
- return [[[self alloc] initWithInfo:info] autorelease];
+ return [[[self alloc] initWithInfo:info] autorelease];
}
- (id) initWithInfo:(NSDictionary *)info
{
- self = [super init];
-
- _netService = mailcore::NetService::serviceWithInfo(info.mco_mcHashMap);
- _netService->retain();
-
- return self;
+ self = [super init];
+
+ _netService = mailcore::NetService::serviceWithInfo(info.mco_mcHashMap);
+ _netService->retain();
+
+ return self;
}
- (id) initWithNetService:(mailcore::NetService *)netService
{
- self = [super init];
-
- _netService = netService;
- _netService->retain();
-
- return self;
+ self = [super init];
+
+ _netService = netService;
+ _netService->retain();
+
+ return self;
+}
+
+- (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];
}
MCO_OBJC_SYNTHESIZE_STRING(setHostname, hostname)
@@ -66,20 +74,20 @@ MCO_OBJC_SYNTHESIZE_SCALAR(MCOConnectionType, mailcore::ConnectionType, setConne
- (NSDictionary *) info
{
- return [NSDictionary mco_dictionaryWithMCHashMap:_netService->info()];
+ return [NSDictionary mco_dictionaryWithMCHashMap:_netService->info()];
}
- (NSString *) hostnameWithEmail:(NSString *)email
{
- NSString *result = nil;
- NSArray *components = [email componentsSeparatedByString:@"@"];
- if (components.count == 0) {
- return self.hostname;
- }
- else {
- result = [self.hostname stringByReplacingOccurrencesOfString:@"{domain}" withString:[components lastObject]];
- }
- return [NSString mco_stringWithMCString:_netService->normalizedHostnameWithEmail(email.mco_mcString)];
+ NSString *result = nil;
+ NSArray *components = [email componentsSeparatedByString:@"@"];
+ if (components.count == 0) {
+ return self.hostname;
+ }
+ else {
+ result = [self.hostname stringByReplacingOccurrencesOfString:@"{domain}" withString:[components lastObject]];
+ }
+ return [NSString mco_stringWithMCString:_netService->normalizedHostnameWithEmail(email.mco_mcString)];
}
@end \ No newline at end of file
diff --git a/src/objc/rfc822/MCOAttachment.h b/src/objc/rfc822/MCOAttachment.h
index 50a2d1a7..560f4590 100644
--- a/src/objc/rfc822/MCOAttachment.h
+++ b/src/objc/rfc822/MCOAttachment.h
@@ -16,7 +16,7 @@
It can either parsed from RFC 822 message data or created to build a message.*/
-@interface MCOAttachment : MCOAbstractPart <NSCopying>
+@interface MCOAttachment : MCOAbstractPart
/** Returns a MIME type for a filename.*/
+ (NSString *) mimeTypeForFilename:(NSString *)filename;
diff --git a/src/objc/rfc822/MCOAttachment.mm b/src/objc/rfc822/MCOAttachment.mm
index 423ac0df..5b20e583 100644
--- a/src/objc/rfc822/MCOAttachment.mm
+++ b/src/objc/rfc822/MCOAttachment.mm
@@ -26,14 +26,6 @@
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/MCOMessageParser.h b/src/objc/rfc822/MCOMessageParser.h
index 82613403..5a009bb7 100644
--- a/src/objc/rfc822/MCOMessageParser.h
+++ b/src/objc/rfc822/MCOMessageParser.h
@@ -20,7 +20,7 @@
@protocol MCOHTMLRendererDelegate;
-@interface MCOMessageParser : MCOAbstractMessage <NSCopying>
+@interface MCOMessageParser : MCOAbstractMessage
/** returns a parsed message from the given RFC 822 data.*/
+ (MCOMessageParser *) messageParserWithData:(NSData *)data;
diff --git a/src/objc/rfc822/MCOMessageParser.mm b/src/objc/rfc822/MCOMessageParser.mm
index 84631430..8e3f1261 100644
--- a/src/objc/rfc822/MCOMessageParser.mm
+++ b/src/objc/rfc822/MCOMessageParser.mm
@@ -26,14 +26,6 @@
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;
diff --git a/src/objc/rfc822/MCOMessagePart.mm b/src/objc/rfc822/MCOMessagePart.mm
index f1535049..4ed4a6d7 100644
--- a/src/objc/rfc822/MCOMessagePart.mm
+++ b/src/objc/rfc822/MCOMessagePart.mm
@@ -22,14 +22,6 @@
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.h b/src/objc/rfc822/MCOMultipart.h
index e45d4a0c..a730b8a4 100644
--- a/src/objc/rfc822/MCOMultipart.h
+++ b/src/objc/rfc822/MCOMultipart.h
@@ -14,7 +14,7 @@
/** Multipart parsed from RFC 822 message data. */
-@interface MCOMultipart : MCOAbstractMultipart <NSCopying>
+@interface MCOMultipart : MCOAbstractMultipart
@end
diff --git a/src/objc/rfc822/MCOMultipart.mm b/src/objc/rfc822/MCOMultipart.mm
index 2267f775..78fa1a98 100644
--- a/src/objc/rfc822/MCOMultipart.mm
+++ b/src/objc/rfc822/MCOMultipart.mm
@@ -22,14 +22,6 @@
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;