aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/imap
diff options
context:
space:
mode:
authorGravatar CodaFi <devteam.codafi@gmail.com>2013-06-20 16:31:54 -0600
committerGravatar CodaFi <devteam.codafi@gmail.com>2013-06-20 16:31:54 -0600
commite3ae2f0b8a83e939f37dff0b32f33b5c7b7e2d8e (patch)
tree75fa36c7ad8f0428a3a58c8abcb3532294265ff4 /src/objc/imap
parent06c4537db1a6ffd1112e92319f7c820016109f58 (diff)
Redo commits
Diffstat (limited to 'src/objc/imap')
-rw-r--r--src/objc/imap/MCOIMAPFolder.h2
-rw-r--r--src/objc/imap/MCOIMAPFolder.mm18
-rw-r--r--src/objc/imap/MCOIMAPMessage.h2
-rw-r--r--src/objc/imap/MCOIMAPMessage.mm24
-rw-r--r--src/objc/imap/MCOIMAPMessagePart.h2
-rw-r--r--src/objc/imap/MCOIMAPMessagePart.mm14
-rw-r--r--src/objc/imap/MCOIMAPMultipart.h2
-rw-r--r--src/objc/imap/MCOIMAPMultipart.mm14
-rw-r--r--src/objc/imap/MCOIMAPPart.h2
-rw-r--r--src/objc/imap/MCOIMAPPart.mm18
10 files changed, 93 insertions, 5 deletions
diff --git a/src/objc/imap/MCOIMAPFolder.h b/src/objc/imap/MCOIMAPFolder.h
index 8688ef5b..bf643b54 100644
--- a/src/objc/imap/MCOIMAPFolder.h
+++ b/src/objc/imap/MCOIMAPFolder.h
@@ -15,7 +15,7 @@
#import <Foundation/Foundation.h>
#import <MailCore/MCOConstants.h>
-@interface MCOIMAPFolder : NSObject <NSCopying>
+@interface MCOIMAPFolder : NSObject <NSCoding, NSCopying>
/** The folder's path, like for example INBOX.Archive */
@property (nonatomic, copy) NSString * path;
diff --git a/src/objc/imap/MCOIMAPFolder.mm b/src/objc/imap/MCOIMAPFolder.mm
index 66e36beb..666bb78c 100644
--- a/src/objc/imap/MCOIMAPFolder.mm
+++ b/src/objc/imap/MCOIMAPFolder.mm
@@ -56,6 +56,24 @@
return self;
}
+- (id) initWithCoder:(NSCoder *)aDecoder
+{
+ self = [self init];
+
+ [self setPath:[aDecoder decodeObjectForKey:@"path"]];
+ [self setDelimiter:[aDecoder decodeIntForKey:@"delimiter"]];
+ [self setFlags:(MCOIMAPFolderFlag)[aDecoder decodeInt32ForKey:@"flags"]];
+
+ return self;
+}
+
+- (void) encodeWithCoder:(NSCoder *)aCoder
+{
+ [aCoder encodeObject:[self path] forKey:@"path"];
+ [aCoder encodeInt:[self delimiter] forKey:@"delimiter"];
+ [aCoder encodeInt32:[self flags] forKey:@"flags"];
+}
+
- (void) dealloc
{
MC_SAFE_RELEASE(_nativeFolder);
diff --git a/src/objc/imap/MCOIMAPMessage.h b/src/objc/imap/MCOIMAPMessage.h
index 81dfa9f7..d9b54abe 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 <NSCoding, 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 9984443e..2f6be457 100644
--- a/src/objc/imap/MCOIMAPMessage.mm
+++ b/src/objc/imap/MCOIMAPMessage.mm
@@ -27,6 +27,30 @@
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 b602d93a..c40c2673 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 <NSCoding, 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 827636b3..35c13162 100644
--- a/src/objc/imap/MCOIMAPMessagePart.mm
+++ b/src/objc/imap/MCOIMAPMessagePart.mm
@@ -22,6 +22,14 @@
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();
@@ -30,6 +38,12 @@
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 0e0bb0eb..d6eb55cb 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 <NSCoding, 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 fdfe4e7a..1cc60e05 100644
--- a/src/objc/imap/MCOIMAPMultipart.mm
+++ b/src/objc/imap/MCOIMAPMultipart.mm
@@ -22,6 +22,20 @@
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 029135bf..bf897f2f 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 <NSCoding, 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 80b86d23..78361c51 100644
--- a/src/objc/imap/MCOIMAPPart.mm
+++ b/src/objc/imap/MCOIMAPPart.mm
@@ -22,6 +22,24 @@
MCORegisterClass(self, &typeid(nativeType));
}
+- (id) initWithCoder:(NSCoder *)aDecoder {
+ self = [super initWithCoder:aDecoder];
+
+ [self setPartID:[aDecoder decodeObjectForKey:@"partID"]];
+ [self setSize:(unsigned int) [aDecoder decodeInt64ForKey:@"size"]];
+ [self setEncoding:(MCOEncoding) [aDecoder decodeIntForKey:@"encoding"]];
+
+ return self;
+}
+
+- (void) encodeWithCoder:(NSCoder *)aCoder
+{
+ [super encodeWithCoder:aCoder];
+ [aCoder encodeObject:[self partID] forKey:@"partID"];
+ [aCoder encodeInt64:[self size] forKey:@"size"];
+ [aCoder encodeInt:[self encoding] forKey:@"encoding"];
+}
+
- (id) copyWithZone:(NSZone *)zone
{
nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy();