aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/abstract
diff options
context:
space:
mode:
authorGravatar Maksim Bauer <m.bauer@zertificon.com>2014-08-01 13:02:10 +0200
committerGravatar Maksim Bauer <m.bauer@zertificon.com>2014-08-01 13:02:10 +0200
commit19e87b40bd40b6fc6cf7607763bf22500122765c (patch)
tree6328cde6e3902609eac6dca2b0504b3db5c06807 /src/objc/abstract
parenta54b838b7f14055716b4da64ea18c5652136d052 (diff)
parent6f5f44ff92337b6f34e6f6d10d9135661b164b0c (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: src/objc/abstract/MCOAbstractPart.h
Diffstat (limited to 'src/objc/abstract')
-rw-r--r--src/objc/abstract/MCOAbstractPart.h5
-rw-r--r--src/objc/abstract/MCOAddress.mm16
-rw-r--r--src/objc/abstract/MCOConstants.h44
3 files changed, 40 insertions, 25 deletions
diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h
index 54c30e31..e30f09bf 100644
--- a/src/objc/abstract/MCOAbstractPart.h
+++ b/src/objc/abstract/MCOAbstractPart.h
@@ -14,7 +14,7 @@
@class MCOAbstractMessage;
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOPartType) {
// Used for a single part.
// The part will be a MCOAbstractPart.
MCOPartTypeSingle,
@@ -39,8 +39,7 @@ typedef enum {
// Used for a signed message, multipart/signed.
// The part will be a MCOAbstractMultipart.
MCOPartTypeMultipartSigned,
-
-} MCOPartType;
+};
@interface MCOAbstractPart : NSObject <NSCopying>
diff --git a/src/objc/abstract/MCOAddress.mm b/src/objc/abstract/MCOAddress.mm
index 679df967..b03b6aa7 100644
--- a/src/objc/abstract/MCOAddress.mm
+++ b/src/objc/abstract/MCOAddress.mm
@@ -159,6 +159,22 @@ MCO_OBJC_SYNTHESIZE_STRING(setMailbox, mailbox)
return MCO_OBJC_BRIDGE_GET(nonEncodedRFC822String);
}
+- (NSUInteger) hash
+{
+ return [[self displayName] hash] ^ [[self mailbox] hash];
+}
+
+- (BOOL) isEqual:(id)object
+{
+ if (![object isKindOfClass:[MCOAddress class]]) {
+ return NO;
+ }
+
+ MCOAddress * other = object;
+ return [[self displayName] isEqualToString:[other displayName]] &&
+ [[self mailbox] isEqualToString:[other mailbox]];
+}
+
@end
@implementation NSArray (MCOAddress)
diff --git a/src/objc/abstract/MCOConstants.h b/src/objc/abstract/MCOConstants.h
index eb276e0f..32a1b1bb 100644
--- a/src/objc/abstract/MCOConstants.h
+++ b/src/objc/abstract/MCOConstants.h
@@ -3,7 +3,7 @@
#define MAILCORE_MCOCONSTANTS_H
/** It's the connection type.*/
-typedef enum {
+typedef NS_OPTIONS(NSInteger, MCOConnectionType) {
/** Clear-text connection for the protocol.*/
MCOConnectionTypeClear = 1 << 0,
/** Clear-text connection at the beginning, then switch to encrypted connection using TLS/SSL*/
@@ -11,10 +11,10 @@ typedef enum {
MCOConnectionTypeStartTLS = 1 << 1,
/** Encrypted connection using TLS/SSL.*/
MCOConnectionTypeTLS = 1 << 2,
-} MCOConnectionType;
+};
/** It's the authentication type.*/
-typedef enum {
+typedef NS_OPTIONS(NSInteger, MCOAuthType) {
/** Default authentication scheme of the protocol.*/
MCOAuthTypeSASLNone = 0,
/** CRAM-MD5 authentication RFC 2195.*/
@@ -37,10 +37,10 @@ typedef enum {
MCOAuthTypeXOAuth2 = 1 << 8,
/** OAuth2 authentication on outlook.com.*/
MCOAuthTypeXOAuth2Outlook = 1 << 9,
-} MCOAuthType;
+};
/** It's the IMAP flags of the folder.*/
-typedef enum {
+typedef NS_OPTIONS(NSInteger, MCOIMAPFolderFlag) {
MCOIMAPFolderFlagNone = 0,
/** \Marked*/
MCOIMAPFolderFlagMarked = 1 << 0,
@@ -77,10 +77,10 @@ typedef enum {
/** Mask to identify the folder */
MCOIMAPFolderFlagFolderTypeMask = MCOIMAPFolderFlagInbox | MCOIMAPFolderFlagSentMail | MCOIMAPFolderFlagStarred | MCOIMAPFolderFlagAllMail |
MCOIMAPFolderFlagTrash| MCOIMAPFolderFlagDrafts | MCOIMAPFolderFlagSpam | MCOIMAPFolderFlagImportant | MCOIMAPFolderFlagArchive,
-} MCOIMAPFolderFlag;
+};
/** It's the flags of a message.*/
-typedef enum {
+typedef NS_OPTIONS(NSInteger, MCOMessageFlag) {
MCOMessageFlagNone = 0,
/** Seen/Read flag.*/
MCOMessageFlagSeen = 1 << 0,
@@ -100,10 +100,10 @@ typedef enum {
MCOMessageFlagSubmitPending = 1 << 7,
/** $Submitted flag.*/
MCOMessageFlagSubmitted = 1 << 8,
-} MCOMessageFlag;
+};
/** It's the encoding of a part.*/
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOEncoding) {
/** 7bit encoding.*/
MCOEncoding7Bit = 0, /** should match MAILIMAP_BODY_FLD_ENC_7BIT*/
/** 8bit encoding.*/
@@ -121,10 +121,10 @@ typedef enum {
/** UUEncode encoding.*/
MCOEncodingUUEncode = -1
-} MCOEncoding;
+};
/** It's the information to fetch for a given message in the IMAP FETCH request.*/
-typedef enum {
+typedef NS_OPTIONS(NSInteger, MCOIMAPMessagesRequestKind) {
/** UID of the message.*/
MCOIMAPMessagesRequestKindUid = 0, /** This is the default and it's always fetched*/
/** Flags of the message.*/
@@ -150,20 +150,20 @@ typedef enum {
/* Request size of message */
MCOIMAPMessagesRequestKindSize = 1 << 10,
-} MCOIMAPMessagesRequestKind;
+};
/** It defines the behavior of the STORE flags request.*/
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOIMAPStoreFlagsRequestKind) {
/** Add the given flags.*/
MCOIMAPStoreFlagsRequestKindAdd,
/** Remove the given flags.*/
MCOIMAPStoreFlagsRequestKindRemove,
/** Set the given flags.*/
MCOIMAPStoreFlagsRequestKindSet,
-} MCOIMAPStoreFlagsRequestKind;
+};
/** It's the search type.*/
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOIMAPSearchKind) {
/** Search All */
MCOIMAPSearchKindAll,
/** No search.*/
@@ -234,7 +234,7 @@ typedef enum {
MCOIMAPSearchKindAnd,
/** Not expression.*/
MCOIMAPSearchKindNot,
-} MCOIMAPSearchKind;
+};
/** Keys for the namespace dictionary.*/
#define MCOIMAPNamespacePersonal @"IMAPNamespacePersonal"
@@ -243,7 +243,7 @@ typedef enum {
/** This is the constants for the IMAP capabilities.*/
/** See corresponding RFC for more information.*/
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOIMAPCapability) {
/** ACL Capability.*/
MCOIMAPCapabilityACL,
/** BINARY Capability.*/
@@ -314,13 +314,13 @@ typedef enum {
MCOIMAPCapabilityXOAuth2,
/** X-GM-EXT-1 Capability.*/
MCOIMAPCapabilityGmail
-} MCOIMAPCapability;
+};
/** Error domain for mailcore.*/
#define MCOErrorDomain @"MCOErrorDomain"
/** Here's the list of errors.*/
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOErrorCode) {
/** No error occurred.*/
MCOErrorNone,
/** An error related to the connection occurred.*/
@@ -402,10 +402,10 @@ typedef enum {
MCOErrorNoop,
/** The count of all errors */
MCOErrorCodeCount,
-} MCOErrorCode;
+};
/** Here's the list of connection log types.*/
-typedef enum {
+typedef NS_ENUM(NSInteger, MCOConnectionLogType) {
/** Received data.*/
MCOConnectionLogTypeReceived,
/** Sent data.*/
@@ -418,7 +418,7 @@ typedef enum {
MCOConnectionLogTypeErrorReceived,
/** Error while sending dataThe data passed to the log will be nil.*/
MCOConnectionLogTypeErrorSent,
-} MCOConnectionLogType;
+};
/**
It's a network traffic logger.