aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/abstract/MCMessageConstants.h4
-rw-r--r--src/core/basetypes/MCObject.h6
-rw-r--r--src/core/renderer/MCHTMLRenderer.cpp2
-rw-r--r--src/core/renderer/MCHTMLRendererCallback.cpp2
-rw-r--r--src/core/renderer/MCHTMLRendererCallback.h2
-rw-r--r--src/core/rfc822/MCAttachment.cc2
-rw-r--r--src/core/rfc822/MCAttachment.h2
-rw-r--r--src/core/rfc822/MCMessageParser.h6
-rw-r--r--src/objc/MCObjC.h12
-rw-r--r--src/objc/abstract/MCOAbstractMessage+Private.h26
-rw-r--r--src/objc/abstract/MCOAbstractMessage.h6
-rw-r--r--src/objc/abstract/MCOAbstractMessage.mm28
-rw-r--r--src/objc/abstract/MCOAbstractMessagePart.h7
-rw-r--r--src/objc/abstract/MCOAbstractMessagePart.mm21
-rw-r--r--src/objc/abstract/MCOAbstractMultipart.h6
-rw-r--r--src/objc/abstract/MCOAbstractMultipart.mm10
-rw-r--r--src/objc/abstract/MCOAbstractPart+Private.h8
-rw-r--r--src/objc/abstract/MCOAbstractPart.h6
-rw-r--r--src/objc/abstract/MCOAbstractPart.mm115
-rw-r--r--src/objc/abstract/MCOAddress+Private.h6
-rw-r--r--src/objc/abstract/MCOAddress.h6
-rw-r--r--src/objc/abstract/MCOAddress.mm41
-rw-r--r--src/objc/abstract/MCOConstants.h (renamed from src/objc/MCOConstants.h)0
-rw-r--r--src/objc/abstract/MCOMessageHeader+Private.h6
-rw-r--r--src/objc/abstract/MCOMessageHeader.h10
-rw-r--r--src/objc/abstract/MCOMessageHeader.mm223
-rw-r--r--src/objc/imap/MCOIMAP.h10
-rw-r--r--src/objc/imap/MCOIMAPCheckAccountOperation.h8
-rw-r--r--src/objc/imap/MCOIMAPCheckAccountOperation.mm4
-rw-r--r--src/objc/imap/MCOIMAPFetchFoldersOperation.h8
-rw-r--r--src/objc/imap/MCOIMAPFetchFoldersOperation.mm4
-rw-r--r--src/objc/imap/MCOIMAPSession.h14
-rw-r--r--src/objc/imap/MCOIMAPSession.mm8
-rw-r--r--src/objc/rfc822/MCOAttachment.h27
-rw-r--r--src/objc/rfc822/MCOAttachment.mm81
-rw-r--r--src/objc/rfc822/MCOMessageBuilder.h32
-rw-r--r--src/objc/rfc822/MCOMessageBuilder.mm52
-rw-r--r--src/objc/rfc822/MCOMessageParser.h51
-rw-r--r--src/objc/rfc822/MCOMessageParser.mm70
-rw-r--r--src/objc/rfc822/MCOMessagePart.h19
-rw-r--r--src/objc/rfc822/MCOMessagePart.mm31
-rw-r--r--src/objc/rfc822/MCOMultipart.h19
-rw-r--r--src/objc/rfc822/MCOMultipart.mm31
-rw-r--r--src/objc/rfc822/MCORFC822.h19
-rw-r--r--src/objc/utils/MCOObjectWrapper.h6
-rw-r--r--src/objc/utils/MCOOperation+Private.h8
-rw-r--r--src/objc/utils/MCOOperation.h6
-rw-r--r--src/objc/utils/MCOUtils.h24
-rw-r--r--src/objc/utils/NSArray+MCO.h6
-rw-r--r--src/objc/utils/NSData+MCO.h6
-rw-r--r--src/objc/utils/NSDictionary+MCO.h6
-rw-r--r--src/objc/utils/NSError+MCO.h7
-rw-r--r--src/objc/utils/NSObject+MCO.h63
-rw-r--r--src/objc/utils/NSObject+MCO.mm4
-rw-r--r--src/objc/utils/NSString+MCO.h6
-rw-r--r--src/objc/utils/NSValue+MCO.h8
56 files changed, 793 insertions, 408 deletions
diff --git a/src/core/abstract/MCMessageConstants.h b/src/core/abstract/MCMessageConstants.h
index e3a7c3e3..7b406097 100644
--- a/src/core/abstract/MCMessageConstants.h
+++ b/src/core/abstract/MCMessageConstants.h
@@ -90,6 +90,7 @@ namespace mailcore {
IMAPCapabilityCondstore,
IMAPCapabilityEnable,
IMAPCapabilityIdle,
+ IMAPCapabilityId,
IMAPCapabilityLiteralPlus,
IMAPCapabilityMultiAppend,
IMAPCapabilityNamespace,
@@ -196,7 +197,8 @@ namespace mailcore {
ErrorAuthenticationRequired,
ErrorFetchMessageList,
ErrorDeleteMessage,
- ErrorInvalidAccount,
+ ErrorInvalidAccount,
+ ErrorCapability,
};
enum PartType {
diff --git a/src/core/basetypes/MCObject.h b/src/core/basetypes/MCObject.h
index caeded70..0fd65d09 100644
--- a/src/core/basetypes/MCObject.h
+++ b/src/core/basetypes/MCObject.h
@@ -6,6 +6,10 @@
#ifdef __cplusplus
+#define MC_PROPERTY(mcType, setter, getter) \
+ virtual void setter(mcType * getter); \
+ virtual mcType * getter();
+
namespace mailcore {
extern bool zombieEnabled;
@@ -23,7 +27,7 @@ namespace mailcore {
virtual Object * autorelease();
virtual String * description();
virtual String * className();
-
+
virtual bool isEqual(Object * otherObject);
virtual unsigned int hash();
diff --git a/src/core/renderer/MCHTMLRenderer.cpp b/src/core/renderer/MCHTMLRenderer.cpp
index ba78656b..d168cd8e 100644
--- a/src/core/renderer/MCHTMLRenderer.cpp
+++ b/src/core/renderer/MCHTMLRenderer.cpp
@@ -333,7 +333,7 @@ String * htmlForAbstractMessagePart(AbstractMessagePart * part, htmlRendererCont
String * result = String::string();
HashMap * values = context->htmlCallback->templateValuesForHeader(part->header());
- String * headerString = renderTemplate(context->htmlCallback->templateForMainHeader(), values);
+ String * headerString = renderTemplate(context->htmlCallback->templateForEmbeddedMessageHeader(), values);
result->appendString(headerString);
result->appendString(substring);
return result;
diff --git a/src/core/renderer/MCHTMLRendererCallback.cpp b/src/core/renderer/MCHTMLRendererCallback.cpp
index 3ceaeb40..4de4630c 100644
--- a/src/core/renderer/MCHTMLRendererCallback.cpp
+++ b/src/core/renderer/MCHTMLRendererCallback.cpp
@@ -206,7 +206,7 @@ mailcore::String * HTMLRendererTemplateCallback::templateForMainHeader()
</div>");
}
-mailcore::String * HTMLRendererTemplateCallback::templateForHeader()
+mailcore::String * HTMLRendererTemplateCallback::templateForEmbeddedMessageHeader()
{
return templateForMainHeader();
}
diff --git a/src/core/renderer/MCHTMLRendererCallback.h b/src/core/renderer/MCHTMLRendererCallback.h
index 2972249e..c2015e16 100644
--- a/src/core/renderer/MCHTMLRendererCallback.h
+++ b/src/core/renderer/MCHTMLRendererCallback.h
@@ -33,11 +33,11 @@ namespace mailcore {
virtual HashMap * templateValuesForPart(AbstractPart * part);
virtual String * templateForMainHeader();
- virtual String * templateForHeader();
virtual String * templateForImage();
virtual String * templateForAttachment();
virtual String * templateForMessage();
virtual String * templateForEmbeddedMessage();
+ virtual String * templateForEmbeddedMessageHeader();
virtual String * templateForAttachmentSeparator();
virtual String * filterHTMLForPart(String * html);
diff --git a/src/core/rfc822/MCAttachment.cc b/src/core/rfc822/MCAttachment.cc
index 7926baa9..5020ebd9 100644
--- a/src/core/rfc822/MCAttachment.cc
+++ b/src/core/rfc822/MCAttachment.cc
@@ -121,7 +121,7 @@ String * Attachment::mimeTypeForFilename(String * filename)
return NULL;
}
-Attachment * Attachment::attachmentWithContentOfFile(String * filename)
+Attachment * Attachment::attachmentWithContentsOfFile(String * filename)
{
Attachment * attachment;
String * mimeType;
diff --git a/src/core/rfc822/MCAttachment.h b/src/core/rfc822/MCAttachment.h
index ac12a5b5..ed0d8f1d 100644
--- a/src/core/rfc822/MCAttachment.h
+++ b/src/core/rfc822/MCAttachment.h
@@ -16,7 +16,7 @@ namespace mailcore {
class Attachment : public AbstractPart {
public:
static String * mimeTypeForFilename(String * filename);
- static Attachment * attachmentWithContentOfFile(String * filename);
+ static Attachment * attachmentWithContentsOfFile(String * filename);
static Attachment * attachmentWithHTMLString(String * htmlString);
static Attachment * attachmentWithRFC822Message(Data * messageData);
static Attachment * attachmentWithText(String * text);
diff --git a/src/core/rfc822/MCMessageParser.h b/src/core/rfc822/MCMessageParser.h
index ff2f1f50..ba129933 100644
--- a/src/core/rfc822/MCMessageParser.h
+++ b/src/core/rfc822/MCMessageParser.h
@@ -22,9 +22,6 @@ namespace mailcore {
virtual AbstractPart * mainPart();
virtual Data * data();
- virtual AbstractPart * partForContentID(String * contentID);
- virtual AbstractPart * partForUniqueID(String * uniqueID);
-
virtual String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL);
public: // subclass behavior
@@ -32,6 +29,9 @@ namespace mailcore {
virtual String * description();
virtual Object * copy();
+ virtual AbstractPart * partForContentID(String * contentID);
+ virtual AbstractPart * partForUniqueID(String * uniqueID);
+
private:
Data * mData;
AbstractPart * mMainPart;
diff --git a/src/objc/MCObjC.h b/src/objc/MCObjC.h
index 31aba9c1..a54af7d6 100644
--- a/src/objc/MCObjC.h
+++ b/src/objc/MCObjC.h
@@ -11,17 +11,7 @@
#ifdef __OBJC__
-#import <mailcore/MCOObjectWrapper.h>
-#import <mailcore/NSData+MCO.h>
-#import <mailcore/NSString+MCO.h>
-#import <mailcore/NSDictionary+MCO.h>
-#import <mailcore/NSArray+MCO.h>
-#import <mailcore/NSObject+MCO.h>
-#import <mailcore/MCOObjectWrapper.h>
-#import <mailcore/NSError+MCO.h>
-#import <mailcore/MCOOperation.h>
-#import <mailcore/MCOConstants.h>
-
+#import <mailcore/MCOUtils.h>
#import <mailcore/MCOAbstract.h>
#import <mailcore/MCOIMAP.h>
diff --git a/src/objc/abstract/MCOAbstractMessage+Private.h b/src/objc/abstract/MCOAbstractMessage+Private.h
new file mode 100644
index 00000000..82e94c12
--- /dev/null
+++ b/src/objc/abstract/MCOAbstractMessage+Private.h
@@ -0,0 +1,26 @@
+//
+// MCOAbstractMessage+Private.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/23/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef mailcore2_MCOAbstractMessage_Private_h
+#define mailcore2_MCOAbstractMessage_Private_h
+
+#ifdef __cplusplus
+
+namespace mailcore {
+ class AbstractMessage;
+}
+
+@interface MCOAbstractMessage (Private)
+
+- (id) initWithMCMessage:(mailcore::AbstractMessage *)message;
+
+@end
+
+#endif
+
+#endif
diff --git a/src/objc/abstract/MCOAbstractMessage.h b/src/objc/abstract/MCOAbstractMessage.h
index 60ed63cd..c5a2f27f 100644
--- a/src/objc/abstract/MCOAbstractMessage.h
+++ b/src/objc/abstract/MCOAbstractMessage.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOABSTRACTMESSAGE_H_
+
+#define __MAILCORE_MCOABSTRACTMESSAGE_H_
+
#import <Foundation/Foundation.h>
@class MCOMessageHeader;
@@ -19,3 +23,5 @@
- (MCOAbstractPart *) partForUniqueID:(NSString *)uniqueID;
@end
+
+#endif
diff --git a/src/objc/abstract/MCOAbstractMessage.mm b/src/objc/abstract/MCOAbstractMessage.mm
index d9ab7a95..e0b4bd37 100644
--- a/src/objc/abstract/MCOAbstractMessage.mm
+++ b/src/objc/abstract/MCOAbstractMessage.mm
@@ -21,7 +21,14 @@
mailcore::AbstractMessage * _message;
}
-- (id) initWithPart:(mailcore::AbstractMessage *)message
+#define nativeType mailcore::AbstractMessage
+
+- (mailcore::Object *) mco_mcObject
+{
+ return _message;
+}
+
+- (id) initWithMCMessage:(mailcore::AbstractMessage *)message
{
self = [super init];
@@ -37,29 +44,16 @@
[super dealloc];
}
-- (MCOMessageHeader *) header
-{
- return (MCOMessageHeader *) [NSObject mco_objectWithMCObject:((mailcore::AbstractMessage *) [self mco_mcObject])->header()];
-}
-
-- (void) setHeader:(MCOMessageHeader *)header
-{
- ((mailcore::AbstractMessage *) [self mco_mcObject])->setHeader((mailcore::MessageHeader *) [header mco_mcObject]);
-}
+MCO_OBJC_SYNTHESIZE(MessageHeader, setHeader, header)
- (MCOAbstractPart *) partForContentID:(NSString *)contentID
{
- return (MCOAbstractPart *) [NSObject mco_objectWithMCObject:((mailcore::AbstractMessage *) [self mco_mcObject])->partForContentID([contentID mco_mcString])];
+ return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->partForContentID([contentID mco_mcString]));
}
- (MCOAbstractPart *) partForUniqueID:(NSString *)uniqueID
{
- return (MCOAbstractPart *) [NSObject mco_objectWithMCObject:((mailcore::AbstractMessage *) [self mco_mcObject])->partForUniqueID([uniqueID mco_mcString])];
-}
-
-- (mailcore::Object *) mco_mcObject
-{
- return _message;
+ return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->partForUniqueID([uniqueID mco_mcString]));
}
@end
diff --git a/src/objc/abstract/MCOAbstractMessagePart.h b/src/objc/abstract/MCOAbstractMessagePart.h
index 297df341..8675fc17 100644
--- a/src/objc/abstract/MCOAbstractMessagePart.h
+++ b/src/objc/abstract/MCOAbstractMessagePart.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOABSTRACTMESSAGEPART_H_
+
+#define __MAILCORE_MCOABSTRACTMESSAGEPART_H_
+
#import <Foundation/Foundation.h>
#import <mailcore/MCOAbstractPart.h>
@@ -17,3 +21,6 @@
@property (nonatomic, retain) MCOAbstractPart * mainPart;
@end
+
+#endif
+
diff --git a/src/objc/abstract/MCOAbstractMessagePart.mm b/src/objc/abstract/MCOAbstractMessagePart.mm
index 4468fd6f..7d66a355 100644
--- a/src/objc/abstract/MCOAbstractMessagePart.mm
+++ b/src/objc/abstract/MCOAbstractMessagePart.mm
@@ -16,24 +16,9 @@
@implementation MCOAbstractMessagePart
-- (void) setHeader:(MCOMessageHeader *)header
-{
- ((mailcore::AbstractMessagePart *) [self mco_mcObject])->setHeader((mailcore::MessageHeader *) [header mco_mcObject]);
-}
+#define nativeType mailcore::AbstractMessagePart
-- (MCOMessageHeader *) header
-{
- return (MCOMessageHeader *) [NSObject mco_objectWithMCObject:((mailcore::AbstractMessagePart *) [self mco_mcObject])->header()];
-}
-
-- (void) setMainPart:(MCOAbstractPart *)part
-{
- ((mailcore::AbstractMessagePart *) [self mco_mcObject])->setMainPart((mailcore::AbstractPart *) [part mco_mcObject]);
-}
-
-- (MCOAbstractPart *) mainPart
-{
- return (MCOAbstractPart *) [NSObject mco_objectWithMCObject:((mailcore::AbstractMessagePart *) [self mco_mcObject])->mainPart()];
-}
+MCO_OBJC_SYNTHESIZE(MessageHeader, setHeader, header)
+MCO_OBJC_SYNTHESIZE(AbstractMessagePart, setMainPart, mainPart)
@end
diff --git a/src/objc/abstract/MCOAbstractMultipart.h b/src/objc/abstract/MCOAbstractMultipart.h
index 37422d71..3eeb6794 100644
--- a/src/objc/abstract/MCOAbstractMultipart.h
+++ b/src/objc/abstract/MCOAbstractMultipart.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOABSTRACTMULTIPART_H_
+
+#define __MAILCORE_MCOABSTRACTMULTIPART_H_
+
#import <Foundation/Foundation.h>
#import <mailcore/MCOAbstractPart.h>
@@ -14,3 +18,5 @@
@property (nonatomic, copy) NSArray * parts;
@end
+
+#endif
diff --git a/src/objc/abstract/MCOAbstractMultipart.mm b/src/objc/abstract/MCOAbstractMultipart.mm
index 568471d1..25e633cd 100644
--- a/src/objc/abstract/MCOAbstractMultipart.mm
+++ b/src/objc/abstract/MCOAbstractMultipart.mm
@@ -14,14 +14,8 @@
@implementation MCOAbstractMultipart
-- (NSArray *) parts
-{
- return (NSArray *) [NSObject mco_objectWithMCObject:((mailcore::AbstractMultipart *) [self mco_mcObject])->parts()];
-}
+#define nativeType mailcore::AbstractMultipart
-- (void) setParts:(NSArray *)parts
-{
- ((mailcore::AbstractMultipart *) [self mco_mcObject])->setParts((mailcore::Array *) [parts mco_mcObject]);
-}
+MCO_OBJC_SYNTHESIZE_ARRAY(setParts, parts)
@end
diff --git a/src/objc/abstract/MCOAbstractPart+Private.h b/src/objc/abstract/MCOAbstractPart+Private.h
index abc20944..47ea189b 100644
--- a/src/objc/abstract/MCOAbstractPart+Private.h
+++ b/src/objc/abstract/MCOAbstractPart+Private.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOABSTRACTPART_PRIVATE_H_
+
+#define __MAILCORE_MCOABSTRACTPART_PRIVATE_H_
+
#include <mailcore/MCOAbstractPart.h>
#ifdef __cplusplus
@@ -16,8 +20,10 @@ namespace mailcore {
@interface MCOAbstractPart (Private)
-- (id) initWithPart:(mailcore::AbstractPart *)part;
+- (id) initWithMCPart:(mailcore::AbstractPart *)part;
@end
#endif
+
+#endif
diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h
index 2ffcf338..b46f6724 100644
--- a/src/objc/abstract/MCOAbstractPart.h
+++ b/src/objc/abstract/MCOAbstractPart.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOABSTRACTPART_H_
+
+#define __MAILCORE_MCOABSTRACTPART_H_
+
#import <Foundation/Foundation.h>
@class MCOAbstractMessage;
@@ -34,3 +38,5 @@ typedef enum {
- (MCOAbstractPart *) partForUniqueID:(NSString *)uniqueID;
@end
+
+#endif
diff --git a/src/objc/abstract/MCOAbstractPart.mm b/src/objc/abstract/MCOAbstractPart.mm
index 1e2f2ef7..2adf8891 100644
--- a/src/objc/abstract/MCOAbstractPart.mm
+++ b/src/objc/abstract/MCOAbstractPart.mm
@@ -18,7 +18,14 @@
mailcore::AbstractPart * _part;
}
-- (id) initWithPart:(mailcore::AbstractPart *)part
+#define nativeType mailcore::AbstractPart
+
+- (mailcore::Object *) mco_mcObject
+{
+ return _part;
+}
+
+- (id) initWithMCPart:(mailcore::AbstractPart *)part
{
self = [super init];
@@ -34,109 +41,25 @@
[super dealloc];
}
-- (MCOPartType) partType
-{
- return (MCOPartType) _part->partType();
-}
-
-- (void) setPartType:(MCOPartType)partType
-{
- _part->setPartType((mailcore::PartType) partType);
-}
-
-- (NSString *) filename
-{
- return [NSString mco_stringWithMCString:_part->filename()];
-}
-
-- (void) setFilename:(NSString *)filename
-{
- _part->setFilename([filename mco_mcString]);
-}
-
-- (NSString *) mimeType
-{
- return [NSString mco_stringWithMCString:_part->mimeType()];
-}
-
-- (void) setMimeType:(NSString *)mimeType
-{
- _part->setMimeType([mimeType mco_mcString]);
-}
-
-- (NSString *) charset
-{
- return [NSString mco_stringWithMCString:_part->charset()];
-}
-
-- (void) setCharset:(NSString *)charset
-{
- _part->setCharset([charset mco_mcString]);
-}
+MCO_OBJC_SYNTHESIZE_SCALAR(MCOPartType, mailcore::PartType, setPartType, partType)
-- (NSString *) uniqueID
-{
- return [NSString mco_stringWithMCString:_part->uniqueID()];
-}
-
-- (void) setUniqueID:(NSString *)uniqueID
-{
- _part->setUniqueID([uniqueID mco_mcString]);
-}
-
-- (NSString *) contentID
-{
- return [NSString mco_stringWithMCString:_part->contentID()];
-}
-
-- (void) setContentID:(NSString *)contentID
-{
- _part->setContentID([contentID mco_mcString]);
-}
-
-- (NSString *) contentLocation
-{
- return [NSString mco_stringWithMCString:_part->contentLocation()];
-}
-
-- (void) setContentLocation:(NSString *)contentLocation
-{
- _part->setContentLocation([contentLocation mco_mcString]);
-}
-
-- (BOOL) isInlineAttachment
-{
- return _part->isInlineAttachment();
-}
-
-- (void) setInlineAttachment:(BOOL)inlineAttachment
-{
- _part->setInlineAttachment(inlineAttachment);
-}
-
-- (MCOAbstractMessage *) message
-{
- return (MCOAbstractMessage *) [NSObject mco_objectWithMCObject:_part->message()];
-}
-
-- (void) setMessage:(MCOAbstractMessage *)message
-{
- _part->setMessage((mailcore::AbstractMessage *) [message mco_mcObject]);
-}
+MCO_OBJC_SYNTHESIZE_STRING(setFilename, filename)
+MCO_OBJC_SYNTHESIZE_STRING(setMimeType, mimeType)
+MCO_OBJC_SYNTHESIZE_STRING(setCharset, charset)
+MCO_OBJC_SYNTHESIZE_STRING(setUniqueID, uniqueID)
+MCO_OBJC_SYNTHESIZE_STRING(setContentID, contentID)
+MCO_OBJC_SYNTHESIZE_STRING(setContentLocation, contentLocation)
+MCO_OBJC_SYNTHESIZE_BOOL(setInlineAttachment, isInlineAttachment)
+MCO_OBJC_SYNTHESIZE(AbstractMessage, setMessage, message)
- (MCOAbstractPart *) partForContentID:(NSString *)contentID
{
- return (MCOAbstractPart *) [NSObject mco_objectWithMCObject:_part->partForContentID([contentID mco_mcString])];
+ return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->partForContentID([contentID mco_mcString]));
}
- (MCOAbstractPart *) partForUniqueID:(NSString *)uniqueID
{
- return (MCOAbstractPart *) [NSObject mco_objectWithMCObject:_part->partForUniqueID([uniqueID mco_mcString])];
-}
-
-- (mailcore::Object *) mco_mcObject
-{
- return _part;
+ return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->partForUniqueID([uniqueID mco_mcString]));
}
@end
diff --git a/src/objc/abstract/MCOAddress+Private.h b/src/objc/abstract/MCOAddress+Private.h
index 34fce13c..ac7f7703 100644
--- a/src/objc/abstract/MCOAddress+Private.h
+++ b/src/objc/abstract/MCOAddress+Private.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOADDRESS_PRIVATE_H_
+
+#define __MAILCORE_MCOADDRESS_PRIVATE_H_
+
#ifdef __cplusplus
namespace mailcore {
class Address;
@@ -18,3 +22,5 @@ namespace mailcore {
@end
#endif
+
+#endif
diff --git a/src/objc/abstract/MCOAddress.h b/src/objc/abstract/MCOAddress.h
index b4b1b902..7362af93 100644
--- a/src/objc/abstract/MCOAddress.h
+++ b/src/objc/abstract/MCOAddress.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOADDRESS_H_
+
+#define __MAILCORE_MCOADDRESS_H_
+
#import <Foundation/Foundation.h>
@interface MCOAddress : NSObject <NSCopying>
@@ -26,3 +30,5 @@
- (NSString *) nonEncodedRFC822String;
@end
+
+#endif
diff --git a/src/objc/abstract/MCOAddress.mm b/src/objc/abstract/MCOAddress.mm
index 37727f0c..6afb0134 100644
--- a/src/objc/abstract/MCOAddress.mm
+++ b/src/objc/abstract/MCOAddress.mm
@@ -19,9 +19,11 @@
mailcore::Address * _nativeAddress;
}
+#define nativeType mailcore::Address
+
+ (void) initialize
{
- MCORegisterClass(self, &typeid(mailcore::Address));
+ MCORegisterClass(self, &typeid(nativeType));
}
+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
@@ -30,6 +32,11 @@
return [[[self alloc] initWithMCAddress:address] autorelease];
}
+- (mailcore::Object *) mco_mcObject
+{
+ return _nativeAddress;
+}
+
+ (MCOAddress *) addressWithDisplayName:(NSString *)displayName
mailbox:(NSString *)mailbox
{
@@ -110,42 +117,20 @@
- (NSString *) description
{
- return [NSString mco_stringWithMCObject:_nativeAddress];
-}
-
-- (NSString *) displayName
-{
- return [NSString mco_stringWithMCString:_nativeAddress->displayName()];
-}
-
-- (void) setDisplayName:(NSString *)displayName
-{
- _nativeAddress->setDisplayName([displayName mco_mcString]);
-}
-
-- (NSString *) mailbox
-{
- return [NSString mco_stringWithMCString:_nativeAddress->mailbox()];
+ return MCO_OBJC_BRIDGE_GET(description);
}
-- (void) setMailbox:(NSString *)mailbox
-{
- _nativeAddress->setMailbox([mailbox mco_mcString]);
-}
+MCO_OBJC_SYNTHESIZE_STRING(setDisplayName, displayName)
+MCO_OBJC_SYNTHESIZE_STRING(setMailbox, mailbox)
- (NSString *) RFC822String
{
- return [NSString mco_stringWithMCString:_nativeAddress->RFC822String()];
+ return MCO_OBJC_BRIDGE_GET(RFC822String);
}
- (NSString *) nonEncodedRFC822String
{
- return [NSString mco_stringWithMCString:_nativeAddress->nonEncodedRFC822String()];
-}
-
-- (mailcore::Object *) mco_mcObject
-{
- return _nativeAddress;
+ return MCO_OBJC_BRIDGE_GET(nonEncodedRFC822String);
}
@end
diff --git a/src/objc/MCOConstants.h b/src/objc/abstract/MCOConstants.h
index 257b0d68..257b0d68 100644
--- a/src/objc/MCOConstants.h
+++ b/src/objc/abstract/MCOConstants.h
diff --git a/src/objc/abstract/MCOMessageHeader+Private.h b/src/objc/abstract/MCOMessageHeader+Private.h
index fe7c77bd..1c12736d 100644
--- a/src/objc/abstract/MCOMessageHeader+Private.h
+++ b/src/objc/abstract/MCOMessageHeader+Private.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOMESSAGEHEADER_PRIVATE_H_
+
+#define __MAILCORE_MCOMESSAGEHEADER_PRIVATE_H_
+
#ifdef __cplusplus
namespace mailcore {
class MessageHeader;
@@ -18,3 +22,5 @@ namespace mailcore {
@end
#endif
+
+#endif
diff --git a/src/objc/abstract/MCOMessageHeader.h b/src/objc/abstract/MCOMessageHeader.h
index 97a48023..09ed130e 100644
--- a/src/objc/abstract/MCOMessageHeader.h
+++ b/src/objc/abstract/MCOMessageHeader.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOMESSAGEHEADER_H_
+
+#define __MAILCORE_MCOMESSAGEHEADER_H_
+
#import <Foundation/Foundation.h>
@class MCOAddress;
@@ -26,9 +30,11 @@
@property (nonatomic, copy) NSString * subject;
@property (nonatomic, copy) NSString * userAgent;
-- (NSString *) extractedSuject;
-- (NSString *) partialExtractedSuject;
+- (NSString *) extractedSubject;
+- (NSString *) partialExtractedSubject;
- (void) importHeadersData:(NSData *)data;
@end
+
+#endif
diff --git a/src/objc/abstract/MCOMessageHeader.mm b/src/objc/abstract/MCOMessageHeader.mm
index ac5e8a81..649819e9 100644
--- a/src/objc/abstract/MCOMessageHeader.mm
+++ b/src/objc/abstract/MCOMessageHeader.mm
@@ -18,22 +18,30 @@
#include "NSData+MCO.h"
#include "MCOAddress.h"
#include "MCOAddress+Private.h"
+#include "MCAddress.h"
@implementation MCOMessageHeader {
mailcore::MessageHeader * _nativeHeader;
}
+#define nativeType mailcore::MessageHeader
+
+ (void) initialize
{
- MCORegisterClass(self, &typeid(mailcore::MessageHeader));
+ MCORegisterClass(self, &typeid(nativeType));
}
-+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
++ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::MessageHeader * header = (mailcore::MessageHeader *) object;
return [[[self alloc] initWithMCMessageHeader:header] autorelease];
}
+- (mailcore::Object *) mco_mcObject
+{
+ return _nativeHeader;
+}
+
- (id) init
{
self = [super init];
@@ -71,201 +79,31 @@
- (NSString *) description
{
- return [NSString mco_stringWithMCObject:_nativeHeader];
-}
-
-- (NSString *) messageID
-{
- return [NSString mco_stringWithMCString:_nativeHeader->messageID()];
-}
-
-- (void) setMessageID:(NSString *)messageID
-{
- _nativeHeader->setMessageID([messageID mco_mcString]);
-}
-
-- (NSArray *) references
-{
- mailcore::Array * msgIDs = _nativeHeader->references();
- if (msgIDs == NULL)
- return nil;
-
- NSMutableArray * result = [NSMutableArray array];
- for(unsigned int i = 0 ; i < msgIDs->count() ; i ++) {
- mailcore::String * nativeMsgID = (mailcore::String *) msgIDs->objectAtIndex(i);
- [result addObject:[NSString mco_stringWithMCString:nativeMsgID]];
- }
- return result;
-}
-
-- (void) setReferences:(NSArray *)references
-{
- _nativeHeader->setReferences((mailcore::Array *) [references mco_mcArray]);
-}
-
-- (NSArray *) inReplyTo
-{
- mailcore::Array * msgIDs = _nativeHeader->inReplyTo();
- if (msgIDs == NULL)
- return nil;
-
- NSMutableArray * result = [NSMutableArray array];
- for(unsigned int i = 0 ; i < msgIDs->count() ; i ++) {
- mailcore::String * nativeMsgID = (mailcore::String *) msgIDs->objectAtIndex(i);
- [result addObject:[NSString mco_stringWithMCString:nativeMsgID]];
- }
- return result;
-}
-
-- (void) setInReplyTo:(NSArray *)inReplyTo
-{
- _nativeHeader->setInReplyTo([inReplyTo mco_mcArray]);
-}
-
-- (NSDate *) date
-{
- return [NSDate dateWithTimeIntervalSince1970:_nativeHeader->date()];
-}
-
-- (void) setDate:(NSDate *)date
-{
- _nativeHeader->setDate([date timeIntervalSince1970]);
-}
-
-- (NSDate *) receivedDate
-{
- return [NSDate dateWithTimeIntervalSince1970:((NSTimeInterval) _nativeHeader->receivedDate())];
-}
-
-- (void) setReceivedDate:(NSDate *)receivedDate
-{
- _nativeHeader->setReceivedDate(((NSTimeInterval) [receivedDate timeIntervalSince1970]));
-}
-
-- (MCOAddress *) sender
-{
- return [[[MCOAddress alloc] initWithMCAddress:_nativeHeader->sender()] autorelease];
-}
-
-- (void) setSender:(MCOAddress *)sender
-{
- _nativeHeader->setSender((mailcore::Address *) [sender mco_mcObject]);
-}
-
-- (MCOAddress *) from
-{
- return [MCOAddress addressWithMCAddress:_nativeHeader->from()];
-}
-
-- (void) setFrom:(MCOAddress *)from
-{
- _nativeHeader->setFrom((mailcore::Address *) [from mco_mcObject]);
-}
-
-- (NSArray *) to
-{
- mailcore::Array * addresses = _nativeHeader->to();
- if (addresses == NULL)
- return nil;
-
- NSMutableArray * result = [NSMutableArray array];
- for(unsigned int i = 0 ; i < addresses->count() ; i ++) {
- mailcore::Address * nativeAddress = (mailcore::Address *) addresses->objectAtIndex(i);
- [result addObject:[MCOAddress addressWithMCAddress:nativeAddress]];
- }
- return result;
+ return MCO_OBJC_BRIDGE_GET(description);
}
-- (void) setTo:(NSArray *)to
-{
- _nativeHeader->setTo((mailcore::Array *) [to mco_mcObject]);
-}
+MCO_OBJC_SYNTHESIZE_STRING(setMessageID, messageID)
+MCO_OBJC_SYNTHESIZE_ARRAY(setReferences, references)
+MCO_OBJC_SYNTHESIZE_ARRAY(setInReplyTo, inReplyTo)
+MCO_OBJC_SYNTHESIZE_DATE(setDate, date)
+MCO_OBJC_SYNTHESIZE_DATE(setReceivedDate, receivedDate)
+MCO_OBJC_SYNTHESIZE(Address, setSender, sender)
+MCO_OBJC_SYNTHESIZE(Address, setFrom, from)
+MCO_OBJC_SYNTHESIZE_ARRAY(setTo, to)
+MCO_OBJC_SYNTHESIZE_ARRAY(setCc, cc)
+MCO_OBJC_SYNTHESIZE_ARRAY(setBcc, bcc)
+MCO_OBJC_SYNTHESIZE_ARRAY(setReplyTo, replyTo)
+MCO_OBJC_SYNTHESIZE_STRING(setSubject, subject)
+MCO_OBJC_SYNTHESIZE_STRING(setUserAgent, userAgent)
-- (NSArray *) cc
+- (NSString *) extractedSubject
{
- mailcore::Array * addresses = _nativeHeader->cc();
- if (addresses == NULL)
- return nil;
-
- NSMutableArray * result = [NSMutableArray array];
- for(unsigned int i = 0 ; i < addresses->count() ; i ++) {
- mailcore::Address * nativeAddress = (mailcore::Address *) addresses->objectAtIndex(i);
- [result addObject:[MCOAddress addressWithMCAddress:nativeAddress]];
- }
- return result;
+ return MCO_OBJC_BRIDGE_GET(extractedSubject);
}
-- (void) setCc:(NSArray *)cc
+- (NSString *) partialExtractedSubject
{
- _nativeHeader->setCc((mailcore::Array *) [cc mco_mcObject]);
-}
-
-- (NSArray *) bcc
-{
- mailcore::Array * addresses = _nativeHeader->bcc();
- if (addresses == NULL)
- return nil;
-
- NSMutableArray * result = [NSMutableArray array];
- for(unsigned int i = 0 ; i < addresses->count() ; i ++) {
- mailcore::Address * nativeAddress = (mailcore::Address *) addresses->objectAtIndex(i);
- [result addObject:[MCOAddress addressWithMCAddress:nativeAddress]];
- }
- return result;
-}
-
-- (void) setBcc:(NSArray *)bcc
-{
- _nativeHeader->setBcc((mailcore::Array *) [bcc mco_mcObject]);
-}
-
-- (NSArray *) replyTo
-{
- mailcore::Array * addresses = _nativeHeader->replyTo();
- if (addresses == NULL)
- return nil;
-
- NSMutableArray * result = [NSMutableArray array];
- for(unsigned int i = 0 ; i < addresses->count() ; i ++) {
- mailcore::Address * nativeAddress = (mailcore::Address *) addresses->objectAtIndex(i);
- [result addObject:[MCOAddress addressWithMCAddress:nativeAddress]];
- }
- return result;
-}
-
-- (void) setReplyTo:(NSArray *)replyTo
-{
- _nativeHeader->setReplyTo((mailcore::Array *) [replyTo mco_mcObject]);
-}
-
-- (NSString *) subject
-{
- return [NSString mco_stringWithMCString:_nativeHeader->subject()];
-}
-
-- (void) setSubject:(NSString *)subject
-{
- _nativeHeader->setSubject([subject mco_mcString]);
-}
-
-- (NSString *) userAgent
-{
- return [NSString mco_stringWithMCString:_nativeHeader->userAgent()];
-}
-
-- (void) setUserAgent:(NSString *)userAgent
-{
- _nativeHeader->setUserAgent([userAgent mco_mcString]);
-}
-
-- (NSString *) extractedSuject
-{
- return [NSString mco_stringWithMCString:_nativeHeader->extractedSubject()];
-}
-
-- (NSString *) partialExtractedSuject
-{
- return [NSString mco_stringWithMCString:_nativeHeader->partialExtractedSubject()];
+ return MCO_OBJC_BRIDGE_GET(partialExtractedSubject);
}
- (void) importHeadersData:(NSData *)data
@@ -273,9 +111,4 @@
_nativeHeader->importHeadersData([data mco_mcData]);
}
-- (mailcore::Object *) mco_mcObject
-{
- return _nativeHeader;
-}
-
@end
diff --git a/src/objc/imap/MCOIMAP.h b/src/objc/imap/MCOIMAP.h
index 564373ef..f8dcb30d 100644
--- a/src/objc/imap/MCOIMAP.h
+++ b/src/objc/imap/MCOIMAP.h
@@ -6,6 +6,12 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOIMAP_H_
+
+#define __MAILCORE_MCOIMAP_H_
+
#import <mailcore/MCOIMAPSession.h>
-#import <mailcore/MCOCheckAccountOperation.h>
-#import <mailcore/MCOFetchFoldersOperation.h>
+#import <mailcore/MCOIMAPCheckAccountOperation.h>
+#import <mailcore/MCOIMAPFetchFoldersOperation.h>
+
+#endif
diff --git a/src/objc/imap/MCOIMAPCheckAccountOperation.h b/src/objc/imap/MCOIMAPCheckAccountOperation.h
index 61552dd4..3a14a1fe 100644
--- a/src/objc/imap/MCOIMAPCheckAccountOperation.h
+++ b/src/objc/imap/MCOIMAPCheckAccountOperation.h
@@ -6,8 +6,14 @@
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
+#ifndef __MAILCORE_MCOIMAPCHECKACCOUNTOPERATION_H_
+
+#define __MAILCORE_MCOIMAPCHECKACCOUNTOPERATION_H_
+
#import <mailcore/MCOOperation.h>
-@interface MCOCheckAccountOperation : MCOOperation
+@interface MCOIMAPCheckAccountOperation : MCOOperation
- (void)start:(void (^)(NSError *error))completionBlock;
@end
+
+#endif
diff --git a/src/objc/imap/MCOIMAPCheckAccountOperation.mm b/src/objc/imap/MCOIMAPCheckAccountOperation.mm
index 6cb167a6..3eb0aeb1 100644
--- a/src/objc/imap/MCOIMAPCheckAccountOperation.mm
+++ b/src/objc/imap/MCOIMAPCheckAccountOperation.mm
@@ -16,11 +16,11 @@
using namespace mailcore;
-@interface MCOCheckAccountOperation ()
+@interface MCOIMAPCheckAccountOperation ()
@property (nonatomic, copy) void (^completionBlock)(NSError *error);
@end
-@implementation MCOCheckAccountOperation
+@implementation MCOIMAPCheckAccountOperation
- (void)start:(void (^)(NSError *error))completionBlock {
self.completionBlock = completionBlock;
diff --git a/src/objc/imap/MCOIMAPFetchFoldersOperation.h b/src/objc/imap/MCOIMAPFetchFoldersOperation.h
index 914863d3..65410c39 100644
--- a/src/objc/imap/MCOIMAPFetchFoldersOperation.h
+++ b/src/objc/imap/MCOIMAPFetchFoldersOperation.h
@@ -6,8 +6,14 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOIMAPFETCHFOLDERSOPERATION_H_
+
+#define __MAILCORE_MCOIMAPFETCHFOLDERSOPERATION_H_
+
#import <mailcore/MCOOperation.h>
-@interface MCOFetchFoldersOperation : MCOOperation
+@interface MCOIMAPFetchFoldersOperation : MCOOperation
- (void)start:(void (^)(NSError *error, NSArray *folder))completionBlock;
@end
+
+#endif
diff --git a/src/objc/imap/MCOIMAPFetchFoldersOperation.mm b/src/objc/imap/MCOIMAPFetchFoldersOperation.mm
index 63468fcd..09d5d38e 100644
--- a/src/objc/imap/MCOIMAPFetchFoldersOperation.mm
+++ b/src/objc/imap/MCOIMAPFetchFoldersOperation.mm
@@ -16,11 +16,11 @@
using namespace mailcore;
-@interface MCOFetchFoldersOperation ()
+@interface MCOIMAPFetchFoldersOperation ()
@property (nonatomic, copy) void (^completionBlock)(NSError *error, NSArray *folder);
@end
-@implementation MCOFetchFoldersOperation
+@implementation MCOIMAPFetchFoldersOperation
- (void)start:(void (^)(NSError *error, NSArray *folder))completionBlock {
self.completionBlock = completionBlock;
diff --git a/src/objc/imap/MCOIMAPSession.h b/src/objc/imap/MCOIMAPSession.h
index 88977ded..2e0ab3d2 100644
--- a/src/objc/imap/MCOIMAPSession.h
+++ b/src/objc/imap/MCOIMAPSession.h
@@ -6,12 +6,16 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOIMAPSESSION_H_
+
+#define __MAILCORE_MCOIMAPSESSION_H_
+
#import <Foundation/Foundation.h>
#import <mailcore/MCOConstants.h>
#import <mailcore/MCOOperation.h>
-@class MCOCheckAccountOperation;
-@class MCOFetchFoldersOperation;
+@class MCOIMAPCheckAccountOperation;
+@class MCOIMAPFetchFoldersOperation;
@interface MCOIMAPSession : NSObject
@property (nonatomic, strong) NSString *hostname;
@@ -26,6 +30,8 @@
@property (nonatomic, assign, getter=isVoIPEnabled) BOOL VoIPEnabled;
@property (nonatomic, strong) NSString *delimiter;
-- (MCOCheckAccountOperation *)checkAccountOperation;
-- (MCOFetchFoldersOperation *)fetchAllFoldersOperation;
+- (MCOIMAPCheckAccountOperation *)checkAccountOperation;
+- (MCOIMAPFetchFoldersOperation *)fetchAllFoldersOperation;
@end
+
+#endif
diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm
index 21239e48..1bf23063 100644
--- a/src/objc/imap/MCOIMAPSession.mm
+++ b/src/objc/imap/MCOIMAPSession.mm
@@ -125,16 +125,16 @@ using namespace mailcore;
#pragma mark - Operations
-- (MCOCheckAccountOperation *)checkAccountOperation {
+- (MCOIMAPCheckAccountOperation *)checkAccountOperation {
IMAPOperation *coreOp = self.session->checkAccountOperation();
- MCOCheckAccountOperation *op = [[MCOCheckAccountOperation alloc] initWithMCOperation:coreOp];
+ MCOIMAPCheckAccountOperation *op = [[MCOIMAPCheckAccountOperation alloc] initWithMCOperation:coreOp];
return [op autorelease];
}
-- (MCOFetchFoldersOperation *)fetchAllFoldersOperation {
+- (MCOIMAPFetchFoldersOperation *)fetchAllFoldersOperation {
IMAPOperation *coreOp = self.session->fetchAllFoldersOperation();
- MCOFetchFoldersOperation *op = [[MCOFetchFoldersOperation alloc] initWithMCOperation:coreOp];
+ MCOIMAPFetchFoldersOperation *op = [[MCOIMAPFetchFoldersOperation alloc] initWithMCOperation:coreOp];
return [op autorelease];
}
diff --git a/src/objc/rfc822/MCOAttachment.h b/src/objc/rfc822/MCOAttachment.h
new file mode 100644
index 00000000..fec04cc0
--- /dev/null
+++ b/src/objc/rfc822/MCOAttachment.h
@@ -0,0 +1,27 @@
+//
+// MCOAttachment.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCOATTACHMENT_H_
+
+#define __MAILCORE_MCOATTACHMENT_H_
+
+#import <mailcore/MCOAbstractPart.h>
+
+@interface MCOAttachment : MCOAbstractPart
+
++ (NSString *) mimeTypeForFilename:(NSString *)filename;
++ (MCOAttachment *) attachmentWithContentsOfFile:(NSString *)filename;
++ (MCOAttachment *) attachmentWithHTMLString:(NSString *)htmlString;
++ (MCOAttachment *) attachmentWithRFC822Message:(NSData *)messageData;
++ (MCOAttachment *) attachmentWithText:(NSString *)text;
+
+@property (nonatomic, retain) NSData * data;
+
+@end
+
+#endif
diff --git a/src/objc/rfc822/MCOAttachment.mm b/src/objc/rfc822/MCOAttachment.mm
new file mode 100644
index 00000000..d9906a10
--- /dev/null
+++ b/src/objc/rfc822/MCOAttachment.mm
@@ -0,0 +1,81 @@
+//
+// MCOAttachment.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOAttachment.h"
+
+#include "MCAttachment.h"
+
+#import "MCOAbstractPart+Private.h"
+#import "MCOUtils.h"
+#import "NSString+MCO.h"
+#import "NSObject+MCO.h"
+
+@implementation MCOAttachment {
+ NSData * _data;
+}
+
+#define nativeType mailcore::Attachment
+
++ (void) initialize
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ mailcore::Attachment * attachment = (mailcore::Attachment *) object;
+ return [[[self alloc] initWithMCPart:attachment] autorelease];
+}
+
+- (id) init
+{
+ mailcore::Attachment * attachment = new mailcore::Attachment();
+ self = [super initWithMCPart:attachment];
+ attachment->release();
+
+ return self;
+}
+
+- (void) dealloc
+{
+ [_data release];
+ [super dealloc];
+}
+
++ (NSString *) mimeTypeForFilename:(NSString *)filename
+{
+ return [NSString mco_stringWithMCString:mailcore::Attachment::mimeTypeForFilename([filename mco_mcString])];
+}
+
++ (MCOAttachment *) attachmentWithContentsOfFile:(NSString *)filename
+{
+ mailcore::Attachment * result = mailcore::Attachment::attachmentWithContentsOfFile([filename mco_mcString]);
+ return MCO_TO_OBJC(result);
+}
+
++ (MCOAttachment *) attachmentWithHTMLString:(NSString *)htmlString
+{
+ mailcore::Attachment * result = mailcore::Attachment::attachmentWithHTMLString([htmlString mco_mcString]);
+ return MCO_TO_OBJC(result);
+}
+
++ (MCOAttachment *) attachmentWithRFC822Message:(NSData *)messageData
+{
+ mailcore::Attachment * result = mailcore::Attachment::attachmentWithRFC822Message([messageData mco_mcData]);
+ return MCO_TO_OBJC(result);
+}
+
++ (MCOAttachment *) attachmentWithText:(NSString *)text
+{
+ mailcore::Attachment * result = mailcore::Attachment::attachmentWithText([text mco_mcString]);
+ return MCO_TO_OBJC(result);
+}
+
+MCO_OBJC_SYNTHESIZE_DATA(setData, data)
+
+@end
diff --git a/src/objc/rfc822/MCOMessageBuilder.h b/src/objc/rfc822/MCOMessageBuilder.h
new file mode 100644
index 00000000..8b36da8a
--- /dev/null
+++ b/src/objc/rfc822/MCOMessageBuilder.h
@@ -0,0 +1,32 @@
+//
+// MCOMessageBuilder.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCOMESSAGEBUILDER_H_
+
+#define __MAILCORE_MCOMESSAGEBUILDER_H_
+
+#import <mailcore/MCOAbstractMessage.h>
+
+@class MCOAttachment;
+
+@interface MCOMessageBuilder : MCOAbstractMessage
+
+@property (nonatomic, copy, setter=setHTMLBody:) NSString * htmlBody;
+@property (nonatomic, copy) NSString * textBody;
+@property (nonatomic, copy) NSArray * attachments;
+@property (nonatomic, copy) NSArray * relatedAttachments;
+@property (nonatomic, copy) NSString * boundaryPrefix;
+
+- (void) addAttachment:(MCOAttachment *)attachment;
+- (void) addRelatedAttachment:(MCOAttachment *)attachment;
+
+- (NSData *) data;
+
+@end
+
+#endif
diff --git a/src/objc/rfc822/MCOMessageBuilder.mm b/src/objc/rfc822/MCOMessageBuilder.mm
new file mode 100644
index 00000000..d929e98a
--- /dev/null
+++ b/src/objc/rfc822/MCOMessageBuilder.mm
@@ -0,0 +1,52 @@
+//
+// MCOMessageBuilder.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOMessageBuilder.h"
+
+#include "MCRFC822.h"
+
+#import "MCOUtils.h"
+#import "MCOAbstractMessage+Private.h"
+
+@implementation MCOMessageBuilder
+
+#define nativeType mailcore::MessageBuilder
+
++ (void) initialize
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (id) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ mailcore::MessageBuilder * msg = (mailcore::MessageBuilder *) object;
+ return [[[self alloc] initWithMCMessage:msg] autorelease];
+}
+
+MCO_OBJC_SYNTHESIZE_STRING(setHTMLBody, htmlBody)
+MCO_OBJC_SYNTHESIZE_STRING(setTextBody, textBody)
+MCO_OBJC_SYNTHESIZE_ARRAY(setAttachments, attachments)
+MCO_OBJC_SYNTHESIZE_ARRAY(setRelatedAttachments, relatedAttachments)
+MCO_OBJC_SYNTHESIZE_STRING(setBoundaryPrefix, boundaryPrefix)
+
+- (void) addAttachment:(MCOAttachment *)attachment
+{
+ MCO_NATIVE_INSTANCE->addAttachment(MCO_FROM_OBJC(mailcore::Attachment, attachment));
+}
+
+- (void) addRelatedAttachment:(MCOAttachment *)attachment
+{
+ MCO_NATIVE_INSTANCE->addRelatedAttachment(MCO_FROM_OBJC(mailcore::Attachment, attachment));
+}
+
+- (NSData *) data
+{
+ return MCO_OBJC_BRIDGE_GET(data);
+}
+
+@end
diff --git a/src/objc/rfc822/MCOMessageParser.h b/src/objc/rfc822/MCOMessageParser.h
new file mode 100644
index 00000000..7d086d7a
--- /dev/null
+++ b/src/objc/rfc822/MCOMessageParser.h
@@ -0,0 +1,51 @@
+//
+// MCOMessageParser.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCOMESSAGEPARSER_H_
+
+#define __MAILCORE_MCOMESSAGEPARSER_H_
+
+#import <mailcore/MCOAbstractMessage.h>
+
+@protocol MCOMessageParserDelegate;
+
+@interface MCOMessageParser : MCOAbstractMessage
+
+@property (nonatomic, assign) id <MCOMessageParserDelegate> delegate;
+
++ (MCOMessageParser *) messageParserWithData:(NSData *)data;
+
+- (id) initWithData:(NSData *)data;
+- (void) dealloc;
+
+- (MCOAbstractPart *) mainPart;
+- (NSData *) data;
+
+- (NSString *) htmlRendering;
+
+@end
+
+@protocol MCOMessageParserDelegate
+
+- (BOOL) MCOMessageParser:(MCOMessageParser *)parser canPreviewPart:(MCOAbstractPart *)part;
+- (NSDictionary *) MCOMessageParser:(MCOMessageParser *)parser templateValuesForHeader:(MCOMessageHeader *)part;
+- (NSDictionary *) MCOMessageParser:(MCOMessageParser *)parser templateValuesForPart:(MCOAbstractPart *)part;
+- (NSString *) MCOMessageParser_templateForMainHeader:(MCOMessageParser *)parser;
+- (NSString *) MCOMessageParser_templateForImage:(MCOMessageParser *)parser;
+- (NSString *) MCOMessageParser_templateForAttachment:(MCOMessageParser *)parser;
+- (NSString *) MCOMessageParser_templateForMessage:(MCOMessageParser *)parser;
+- (NSString *) MCOMessageParser_templateForEmbeddedMessage:(MCOMessageParser *)parser;
+- (NSString *) MCOMessageParser_templateForEmbeddedMessageHeader:(MCOMessageParser *)parser;
+- (NSString *) MCOMessageParser_templateForAttachmentSeparator:(MCOMessageParser *)parser;
+
+- (NSString *) MCOMessageParser_filterHTMLForPart:(NSString *)html;
+- (NSString *) MCOMessageParser_filterHTMLForMessage:(NSString *)html;
+
+@end
+
+#endif
diff --git a/src/objc/rfc822/MCOMessageParser.mm b/src/objc/rfc822/MCOMessageParser.mm
new file mode 100644
index 00000000..a964c064
--- /dev/null
+++ b/src/objc/rfc822/MCOMessageParser.mm
@@ -0,0 +1,70 @@
+//
+// MCOMessageParser.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOMessageParser.h"
+
+#include "MCRFC822.h"
+
+#import "NSObject+MCO.h"
+#import "MCOAbstractMessage+Private.h"
+#import "MCOUtils.h"
+
+@implementation MCOMessageParser {
+ id <MCOMessageParserDelegate> _delegate;
+}
+
+@synthesize delegate = _delegate;
+
+#define nativeType mailcore::MessageParser
+
++ (void) initialize
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (id) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ mailcore::MessageParser * msg = (mailcore::MessageParser *) object;
+ return [[[self alloc] initWithMCMessage:msg] autorelease];
+}
+
++ (MCOMessageParser *) messageParserWithData:(NSData *)data
+{
+ return [[[MCOMessageParser alloc] initWithData:data] autorelease];
+}
+
+- (id) initWithData:(NSData *)data
+{
+ mailcore::MessageParser * message = new mailcore::MessageParser([data mco_mcData]);
+ self = [super initWithMCMessage:message];
+ message->release();
+ return self;
+}
+
+- (void) dealloc
+{
+ [super dealloc];
+}
+
+- (MCOAbstractPart *) mainPart
+{
+ return MCO_OBJC_BRIDGE_GET(mainPart);
+}
+
+- (NSData *) data
+{
+ return MCO_OBJC_BRIDGE_GET(data);
+}
+
+- (NSString *) htmlRendering
+{
+#warning should implement callbacks
+ return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->htmlRendering());
+}
+
+@end
diff --git a/src/objc/rfc822/MCOMessagePart.h b/src/objc/rfc822/MCOMessagePart.h
new file mode 100644
index 00000000..7e9ebb05
--- /dev/null
+++ b/src/objc/rfc822/MCOMessagePart.h
@@ -0,0 +1,19 @@
+//
+// MessagePart.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCOMESSAGEPART_H_
+
+#define __MAILCORE_MCOMESSAGEPART_H_
+
+#import <mailcore/MCOAbstractMessagePart.h>
+
+@interface MCOMessagePart : MCOAbstractMessagePart
+
+@end
+
+#endif
diff --git a/src/objc/rfc822/MCOMessagePart.mm b/src/objc/rfc822/MCOMessagePart.mm
new file mode 100644
index 00000000..65e091dd
--- /dev/null
+++ b/src/objc/rfc822/MCOMessagePart.mm
@@ -0,0 +1,31 @@
+//
+// MessagePart.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOMessagePart.h"
+
+#include "MCRFC822.h"
+
+#import "NSObject+MCO.h"
+#import "MCOAbstractPart+Private.h"
+
+@implementation MCOMessagePart
+
+#define nativeType mailcore::MessagePart
+
++ (void) initialize
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (id) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ mailcore::MessagePart * part = (mailcore::MessagePart *) object;
+ return [[[self alloc] initWithMCPart:part] autorelease];
+}
+
+@end
diff --git a/src/objc/rfc822/MCOMultipart.h b/src/objc/rfc822/MCOMultipart.h
new file mode 100644
index 00000000..8eac50db
--- /dev/null
+++ b/src/objc/rfc822/MCOMultipart.h
@@ -0,0 +1,19 @@
+//
+// MCOMultipart.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCOMULTIPART_H_
+
+#define __MAILCORE_MCOMULTIPART_H_
+
+#import <mailcore/MCOAbstractMultipart.h>
+
+@interface MCOMultipart : MCOAbstractMultipart
+
+@end
+
+#endif
diff --git a/src/objc/rfc822/MCOMultipart.mm b/src/objc/rfc822/MCOMultipart.mm
new file mode 100644
index 00000000..a0266503
--- /dev/null
+++ b/src/objc/rfc822/MCOMultipart.mm
@@ -0,0 +1,31 @@
+//
+// MCOMultipart.m
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOMultipart.h"
+
+#include "MCRFC822.h"
+
+#import "NSObject+MCO.h"
+#import "MCOAbstractPart+Private.h"
+
+@implementation MCOMultipart
+
+#define nativeType mailcore::Multipart
+
++ (void) initialize
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (id) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ mailcore::Attachment * attachment = (mailcore::Attachment *) object;
+ return [[[self alloc] initWithMCPart:attachment] autorelease];
+}
+
+@end
diff --git a/src/objc/rfc822/MCORFC822.h b/src/objc/rfc822/MCORFC822.h
new file mode 100644
index 00000000..b85c8e53
--- /dev/null
+++ b/src/objc/rfc822/MCORFC822.h
@@ -0,0 +1,19 @@
+//
+// MCORFC822.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCORFC822_H_
+
+#define __MAILCORE_MCORFC822_H_
+
+#import <mailcore/MCOAttachment.h>
+#import <mailcore/MCOMessageBuilder.h>
+#import <mailcore/MCOMessageParser.h>
+#import <mailcore/MCOMessagePart.h>
+#import <mailcore/MCOMultipart.h>
+
+#endif
diff --git a/src/objc/utils/MCOObjectWrapper.h b/src/objc/utils/MCOObjectWrapper.h
index 6827bde9..2fd34018 100644
--- a/src/objc/utils/MCOObjectWrapper.h
+++ b/src/objc/utils/MCOObjectWrapper.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOOBJECTWRAPPER_H_
+
+#define __MAILCORE_MCOOBJECTWRAPPER_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -23,3 +27,5 @@ namespace mailcore {
#endif
@end
+
+#endif
diff --git a/src/objc/utils/MCOOperation+Private.h b/src/objc/utils/MCOOperation+Private.h
index 620b0fe8..ccd1b983 100644
--- a/src/objc/utils/MCOOperation+Private.h
+++ b/src/objc/utils/MCOOperation+Private.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_MCOPERATION_PRIVATE_H_
+
+#define __MAILCORE_MCOPERATION_PRIVATE_H_
+
#ifdef __cplusplus
namespace mailcore {
class Operation;
@@ -20,4 +24,6 @@ namespace mailcore {
- (mailcore::Operation *)mcOperation;
#endif
- (void)start;
-@end \ No newline at end of file
+@end
+
+#endif
diff --git a/src/objc/utils/MCOOperation.h b/src/objc/utils/MCOOperation.h
index deafa165..e44ea236 100644
--- a/src/objc/utils/MCOOperation.h
+++ b/src/objc/utils/MCOOperation.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
+#ifndef __MAILCORE_MCOOPERATION_H_
+
+#define __MAILCORE_MCOOPERATION_H_
+
#import <Foundation/Foundation.h>
@interface MCOOperation : NSObject
@@ -13,3 +17,5 @@
- (void)cancel;
@end
+
+#endif
diff --git a/src/objc/utils/MCOUtils.h b/src/objc/utils/MCOUtils.h
new file mode 100644
index 00000000..3862ba5b
--- /dev/null
+++ b/src/objc/utils/MCOUtils.h
@@ -0,0 +1,24 @@
+//
+// MCOUtils.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 3/22/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef mailcore2_MCOUtils_h
+#define mailcore2_MCOUtils_h
+
+#import <mailcore/MCOObjectWrapper.h>
+#import <mailcore/NSData+MCO.h>
+#import <mailcore/NSString+MCO.h>
+#import <mailcore/NSDictionary+MCO.h>
+#import <mailcore/NSArray+MCO.h>
+#import <mailcore/NSObject+MCO.h>
+#import <mailcore/MCOObjectWrapper.h>
+#import <mailcore/NSError+MCO.h>
+#import <mailcore/NSValue+MCO.h>
+#import <mailcore/MCOOperation.h>
+#import <mailcore/MCOConstants.h>
+
+#endif
diff --git a/src/objc/utils/NSArray+MCO.h b/src/objc/utils/NSArray+MCO.h
index 769da85d..836ef9c0 100644
--- a/src/objc/utils/NSArray+MCO.h
+++ b/src/objc/utils/NSArray+MCO.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_NSARRAY_MCO_H_
+
+#define __MAILCORE_NSARRAY_MCO_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -23,3 +27,5 @@ namespace mailcore {
#endif
@end
+
+#endif
diff --git a/src/objc/utils/NSData+MCO.h b/src/objc/utils/NSData+MCO.h
index 9a0b39cc..fb581abe 100644
--- a/src/objc/utils/NSData+MCO.h
+++ b/src/objc/utils/NSData+MCO.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_NSDATA_MCO_H_
+
+#define __MAILCORE_NSDATA_MCO_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -23,3 +27,5 @@ namespace mailcore {
#endif
@end
+
+#endif
diff --git a/src/objc/utils/NSDictionary+MCO.h b/src/objc/utils/NSDictionary+MCO.h
index 8e78a872..bdc842de 100644
--- a/src/objc/utils/NSDictionary+MCO.h
+++ b/src/objc/utils/NSDictionary+MCO.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_NSDICTIONARY_MCO_H_
+
+#define __MAILCORE_NSDICTIONARY_MCO_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -23,3 +27,5 @@ namespace mailcore {
#endif
@end
+
+#endif \ No newline at end of file
diff --git a/src/objc/utils/NSError+MCO.h b/src/objc/utils/NSError+MCO.h
index 1d8ca85b..baf48f45 100644
--- a/src/objc/utils/NSError+MCO.h
+++ b/src/objc/utils/NSError+MCO.h
@@ -2,6 +2,9 @@
// Created by mronge on 1/31/13.
//
+#ifndef __MAILCORE_NSERROR_MCO_H_
+
+#define __MAILCORE_NSERROR_MCO_H_
#import <Foundation/Foundation.h>
@@ -11,4 +14,6 @@
#ifdef __cplusplus
+ (NSError *)mco_errorWithErrorCode:(mailcore::ErrorCode)code;
#endif
-@end \ No newline at end of file
+@end
+
+#endif
diff --git a/src/objc/utils/NSObject+MCO.h b/src/objc/utils/NSObject+MCO.h
index 6cc24884..31818ce3 100644
--- a/src/objc/utils/NSObject+MCO.h
+++ b/src/objc/utils/NSObject+MCO.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_NSOBJECT_MCO_H_
+
+#define __MAILCORE_NSOBJECT_MCO_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -18,10 +22,66 @@ namespace mailcore {
}
#endif
+#define MCO_NATIVE_INSTANCE ((nativeType *) [self mco_mcObject])
+
+#define MCO_TO_OBJC(mcValue) \
+ [NSObject mco_objectWithMCObject:((mailcore::Object *) (mcValue))]
+
+#define MCO_FROM_OBJC(type, objcValue) \
+ ((type *) [(objcValue) mco_mcObject])
+
+#define MCO_OBJC_BRIDGE_SET(setter, mcValueType, objcValue) \
+ MCO_NATIVE_INSTANCE->setter((mcValueType *) [(objcValue) mco_mcObject])
+
+#define MCO_OBJC_BRIDGE_GET(getter) \
+ [NSObject mco_objectWithMCObject:MCO_NATIVE_INSTANCE->getter()]
+
+#define MCO_OBJC_SYNTHESIZE_TYPE(objcType, mcType, setter, getter) \
+- (objcType *) getter \
+{ \
+return MCO_OBJC_BRIDGE_GET(getter); \
+} \
+\
+- (void) setter:(objcType *)getter \
+{ \
+MCO_OBJC_BRIDGE_SET(setter, mcType, getter); \
+}
+
+#define MCO_OBJC_SYNTHESIZE(type, setter, getter) \
+ MCO_OBJC_SYNTHESIZE_TYPE(MCO ## type, mailcore::type, setter, getter)
+
+#define MCO_OBJC_SYNTHESIZE_SCALAR(objcType, mcType, setter, getter) \
+- (objcType) getter \
+{ \
+return (objcType) MCO_NATIVE_INSTANCE->getter(); \
+} \
+\
+- (void) setter:(objcType)getter \
+{ \
+MCO_NATIVE_INSTANCE->setter((mcType) getter); \
+}
+
+#define MCO_OBJC_SYNTHESIZE_STRING(setter, getter) MCO_OBJC_SYNTHESIZE_TYPE(NSString, mailcore::String, setter, getter)
+#define MCO_OBJC_SYNTHESIZE_ARRAY(setter, getter) MCO_OBJC_SYNTHESIZE_TYPE(NSArray, mailcore::Array, setter, getter)
+#define MCO_OBJC_SYNTHESIZE_DATA(setter, getter) MCO_OBJC_SYNTHESIZE_TYPE(NSData, mailcore::Data, setter, getter)
+#define MCO_OBJC_SYNTHESIZE_HASHMAP(setter, getter) MCO_OBJC_SYNTHESIZE_TYPE(NSDictionary, mailcore::HashMap, setter, getter)
+#define MCO_OBJC_SYNTHESIZE_BOOL(setter, getter) MCO_OBJC_SYNTHESIZE_SCALAR(BOOL, bool, setter, getter)
+
+#define MCO_OBJC_SYNTHESIZE_DATE(setter, getter) \
+- (NSDate *) getter \
+{ \
+ return [NSDate dateWithTimeIntervalSince1970:MCO_NATIVE_INSTANCE->getter()]; \
+} \
+\
+- (void) setter:(NSDate *)getter \
+{ \
+ MCO_NATIVE_INSTANCE->setter([getter timeIntervalSince1970]); \
+}
+
@interface NSObject (MCO)
#ifdef __cplusplus
-+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object;
++ (id) mco_objectWithMCObject:(mailcore::Object *)object;
- (mailcore::Object *) mco_mcObject;
#endif
@@ -32,3 +92,4 @@ namespace mailcore {
extern void MCORegisterClass(Class aClass, const std::type_info * info);
#endif
+#endif
diff --git a/src/objc/utils/NSObject+MCO.mm b/src/objc/utils/NSObject+MCO.mm
index 52a1bc43..0e0411d0 100644
--- a/src/objc/utils/NSObject+MCO.mm
+++ b/src/objc/utils/NSObject+MCO.mm
@@ -56,7 +56,7 @@ static Class classWithTypeInfo(const std::type_info * info)
@implementation NSObject (MCO)
-+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
++ (id) mco_objectWithMCObject:(mailcore::Object *)object
{
if (&typeid(object) == &typeid(mailcore::Value *)) {
return [NSValue mco_valueWithMCValue:(mailcore::Value *) object];
@@ -76,7 +76,7 @@ static Class classWithTypeInfo(const std::type_info * info)
else {
Class aClass = classWithTypeInfo(&typeid(* object));
MCAssert(aClass != nil);
- return (NSObject *) [aClass mco_objectWithMCObject:object];
+ return [aClass mco_objectWithMCObject:object];
}
}
diff --git a/src/objc/utils/NSString+MCO.h b/src/objc/utils/NSString+MCO.h
index 33cc0b67..b459a846 100644
--- a/src/objc/utils/NSString+MCO.h
+++ b/src/objc/utils/NSString+MCO.h
@@ -6,6 +6,10 @@
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_NSSTRING_MCO_H_
+
+#define __MAILCORE_NSSTRING_MCO_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -25,3 +29,5 @@ namespace mailcore {
#endif
@end
+
+#endif
diff --git a/src/objc/utils/NSValue+MCO.h b/src/objc/utils/NSValue+MCO.h
index bee3c742..484fc205 100644
--- a/src/objc/utils/NSValue+MCO.h
+++ b/src/objc/utils/NSValue+MCO.h
@@ -1,11 +1,15 @@
//
-// NSNumber+MCO.h
+// NSValue+MCO.h
// mailcore2
//
// Created by DINH Viêt Hoà on 3/21/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
+#ifndef __MAILCORE_NSVALUE_MCO_H_
+
+#define __MAILCORE_NSVALUE_MCO_H_
+
#import <Foundation/Foundation.h>
#ifdef __cplusplus
@@ -23,3 +27,5 @@ namespace mailcore {
#endif
@end
+
+#endif