diff options
Diffstat (limited to 'src/objc/rfc822/MCOMessageBuilder.mm')
-rw-r--r-- | src/objc/rfc822/MCOMessageBuilder.mm | 52 |
1 files changed, 52 insertions, 0 deletions
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 |