Inherits from NSObject
Declared in MCOIMAPSession.h
MCOIMAPSession.mm

Overview

This is the main IMAP class from which all operations are created

After calling a method that returns an operation you must call start: on the instance to begin the operation.

Tasks

Other Methods

Folder Operations

Message Actions

Fetching Messages

Fetching Attachment Operations

General IMAP Actions

Search Operations

Rendering Operations

Properties

OAuth2Token

This is the OAuth2 token.

@property (nonatomic, copy) NSString *OAuth2Token

Declared In

MCOIMAPSession.h

allowsFolderConcurrentAccessEnabled

When set to YES, the session is allowed open to open several connections to the same folder.

@property (nonatomic, assign) BOOL allowsFolderConcurrentAccessEnabled

Discussion

Warning: Some older IMAP servers don’t like this

Declared In

MCOIMAPSession.h

authType

This is the authentication type to use to connect. MCOAuthTypeSASLNone means that it uses the clear-text is used (and is the default).

@property (nonatomic, assign) MCOAuthType authType

Discussion

Warning: Important: Over an encrypted connection like TLS, the password will still be secure

Declared In

MCOIMAPSession.h

checkCertificateEnabled

When set to YES, the connection will fail if the certificate is incorrect.

@property (nonatomic, assign, getter=isCheckCertificateEnabled) BOOL checkCertificateEnabled

Declared In

MCOIMAPSession.h

clientIdentity

The identity of the IMAP client.

@property (nonatomic, strong, readonly) MCOIMAPIdentity *clientIdentity

Declared In

MCOIMAPSession.h

connectionLogger

Sets logger callback. The network traffic will be sent to this block.

@property (nonatomic, copy) MCOConnectionLogger connectionLogger

Discussion

[session setConnectionLogger:^(void * connectionID, MCOConnectionLogType type, NSData * data) { NSLog(@“%@”, [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]); // … }];

Declared In

MCOIMAPSession.h

connectionType

This is the encryption type to use. See MCOConnectionType for more information.

@property (nonatomic, assign) MCOConnectionType connectionType

Declared In

MCOIMAPSession.h

defaultNamespace

The default namespace.

@property (nonatomic, strong) MCOIMAPNamespace *defaultNamespace

Declared In

MCOIMAPSession.h

dispatchQueue

This property provides some hints to MCOIMAPSession about where it’s called from. It will make MCOIMAPSession safe. It will also set all the callbacks of operations to run on this given queue. Defaults to the main queue. This property should be used only if there’s performance issue using MCOIMAPSession in the main thread.

@property (nonatomic, retain) dispatch_queue_t dispatchQueue

Declared In

MCOIMAPSession.h

gmailUserDisplayName

Display name of the Gmail user. It will be nil if it’s not a Gmail server.

@property (nonatomic, copy, readonly) NSString *gmailUserDisplayName

Declared In

MCOIMAPSession.h

hostname

This is the hostname of the IMAP server to connect to.

@property (nonatomic, copy) NSString *hostname

Declared In

MCOIMAPSession.h

maximumConnections

Maximum number of connections to the server allowed.

@property (nonatomic, assign) unsigned int maximumConnections

Declared In

MCOIMAPSession.h

operationQueueRunning

The value will be YES when asynchronous operations are running, else it will return NO.

@property (nonatomic, assign, readonly, getter=isOperationQueueRunning) BOOL operationQueueRunning

Declared In

MCOIMAPSession.h

operationQueueRunningChangeBlock

Sets operation running callback. It will be called when operations start or stop running.

@property (nonatomic, copy) MCOOperationQueueRunningChangeBlock operationQueueRunningChangeBlock

Discussion

[session setOperationQueueRunningChangeBlock:^{ if ([session isOperationQueueRunning]) { } else { } }];

Declared In

MCOIMAPSession.h

password

This is the password of the account.

@property (nonatomic, copy) NSString *password

Declared In

MCOIMAPSession.h

port

This is the port of the IMAP server to connect to.

@property (nonatomic, assign) unsigned int port

Declared In

MCOIMAPSession.h

serverIdentity

The identity of the IMAP server.

@property (nonatomic, strong, readonly) MCOIMAPIdentity *serverIdentity

Declared In

MCOIMAPSession.h

timeout

This is the timeout of the connection.

@property (nonatomic, assign) NSTimeInterval timeout

Declared In

MCOIMAPSession.h

username

This is the username of the account.

@property (nonatomic, copy) NSString *username

Declared In

MCOIMAPSession.h

voIPEnabled

When set to YES, VoIP capability will be enabled on the IMAP connection on iOS

@property (nonatomic, assign, getter=isVoIPEnabled) BOOL voIPEnabled

Declared In

MCOIMAPSession.h

Instance Methods

appendMessageOperationWithFolder:messageData:flags:

Returns an operation to add a message to a folder.

- (MCOIMAPAppendMessageOperation *)appendMessageOperationWithFolder:(NSString *)folder messageData:(NSData *)messageData flags:(MCOMessageFlag)flags

Discussion

 MCOIMAPOperation * op = [session appendMessageOperationWithFolder:@"Sent Mail" messageData:rfc822Data flags:MCOMessageFlagNone];
 [op start:^(NSError * error, uint32_t createdUID) {
   if (error == nil) {
     NSLog(@"created message with UID %lu", (unsigned long) createdUID);
   }
 }];

Declared In

MCOIMAPSession.h

appendMessageOperationWithFolder:messageData:flags:customFlags:

Returns an operation to add a message with custom flags to a folder.

- (MCOIMAPAppendMessageOperation *)appendMessageOperationWithFolder:(NSString *)folder messageData:(NSData *)messageData flags:(MCOMessageFlag)flags customFlags:(NSArray *)customFlags

Discussion

 MCOIMAPOperation * op = [session appendMessageOperationWithFolder:@"Sent Mail" messageData:rfc822Data flags:MCOMessageFlagNone customFlags:@[@"$CNS-Greeting-On"]];
 [op start:^(NSError * error, uint32_t createdUID) {
   if (error == nil) {
     NSLog(@"created message with UID %lu", (unsigned long) createdUID);
   }
 }];

Declared In

MCOIMAPSession.h

cancelAllOperations

Cancel all operations

- (void)cancelAllOperations

Declared In

MCOIMAPSession.h

capabilityOperation

Returns an operation to request capabilities of the server. See MCOIMAPCapability for the list of capabilities.

- (MCOIMAPCapabilityOperation *)capabilityOperation

Discussion

 canIdle = NO;
 MCOIMAPCapabilityOperation * op = [session capabilityOperation];
 [op start:^(NSError * error, MCOIndexSet * capabilities) {
   if ([capabilities containsIndex:MCOIMAPCapabilityIdle]) {
     canIdle = YES;
   }
 }];

Declared In

MCOIMAPSession.h

checkAccountOperation

Returns an operation that will check whether the IMAP account is valid.

- (MCOIMAPOperation *)checkAccountOperation

Discussion

 MCOIMAPOperation * op = [session checkAccountOperation];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

connectOperation

Returns an operation that will connect to the given IMAP server without authenticating. Useful for checking initial server capabilities.

- (MCOIMAPOperation *)connectOperation

Discussion

MCOIMAPOperation * op = [session connectOperation]; [op start:^(NSError * error) { }];

Declared In

MCOIMAPSession.h

copyMessagesOperationWithFolder:uids:destFolder:

Returns an operation to copy messages to a folder.

- (MCOIMAPCopyMessagesOperation *)copyMessagesOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids destFolder:(NSString *)destFolder

Discussion

 MCOIMAPCopyMessagesOperation * op = [session copyMessagesOperationWithFolder:@"INBOX"
                                                                         uids:[MCIndexSet indexSetWithIndex:456]
                                                                   destFolder:@"Cocoa"];
 [op start:^(NSError * error, NSDictionary * uidMapping) {
      NSLog(@"copied to folder with UID mapping %@", uidMapping);
 }];

Declared In

MCOIMAPSession.h

createFolderOperation:

Returns an operation that creates a new folder

- (MCOIMAPOperation *)createFolderOperation:(NSString *)folder

Discussion

 MCOIMAPOperation * op = [session createFolderOperation:@"holidays 2013"];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

deleteFolderOperation:

Create an operation for deleting a folder

- (MCOIMAPOperation *)deleteFolderOperation:(NSString *)folder

Discussion

 MCOIMAPOperation * op = [session deleteFolderOperation:@"holidays 2009"];
 [op start:^(NSError * error) {
 }]];

Declared In

MCOIMAPSession.h

disconnectOperation

Returns an operation to disconnect the session. It will disconnect all the sockets created by the session.

- (MCOIMAPOperation *)disconnectOperation

Discussion

MCOIMAPOperation * op = [session disconnectOperation];
[op start:^(NSError * error) {
}];

Declared In

MCOIMAPSession.h

expungeOperation:

Returns an operation to expunge a folder.

- (MCOIMAPOperation *)expungeOperation:(NSString *)folder

Discussion

 MCOIMAPOperation * op = [session expungeOperation:@"INBOX"];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

fetchAllFoldersOperation

Returns an operation that gets all folders

- (MCOIMAPFetchFoldersOperation *)fetchAllFoldersOperation

Discussion

 MCOIMAPFetchFoldersOperation * op = [session fetchAllFoldersOperation];
 [op start:^(NSError * error, NSArray *folders) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageAttachmentByUIDOperationWithFolder:uid:partID:encoding:

Returns an operation to fetch an attachment.

- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uid partID:(NSString *)partID encoding:(MCOEncoding)encoding

Discussion

Example 1:

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentByUIDOperationWithFolder:@"INBOX"
                                                                                         uid:456
                                                                                      partID:@"1.2"
                                                                                    encoding:MCOEncodingBase64];
 [op start:^(NSError * error, NSData * partData) {
 }];

Example 2:

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentByUIDOperationWithFolder:@"INBOX"
                                                                                         uid:[message uid]
                                                                                      partID:[part partID]
                                                                                    encoding:[part encoding]];
 [op start:^(NSError * error, NSData * partData) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageAttachmentByUIDOperationWithFolder:uid:partID:encoding:urgent:

Returns an operation to fetch an attachment.

- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uid partID:(NSString *)partID encoding:(MCOEncoding)encoding urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentByUIDOperationWithFolder:@"INBOX"
                                                                                         uid:456
                                                                                      partID:@"1.2"
                                                                                    encoding:MCOEncodingBase64
                                                                                      urgent:YES];
 [op start:^(NSError * error, NSData * partData) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageAttachmentOperationWithFolder:number:partID:encoding:

Returns an operation to fetch an attachment.

- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentOperationWithFolder:(NSString *)folder number:(uint32_t)number partID:(NSString *)partID encoding:(MCOEncoding)encoding

Discussion

Example 1:

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentOperationWithFolder:@"INBOX"
                                                                                 number:42
                                                                                 partID:@"1.2"
                                                                               encoding:MCOEncodingBase64];
 [op start:^(NSError * error, NSData * partData) {
 }];

Example 2:

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentOperationWithFolder:@"INBOX"
                                                                                 number:[message sequenceNumber]
                                                                                 partID:[part partID]
                                                                               encoding:[part encoding]];
 [op start:^(NSError * error, NSData * partData) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageAttachmentOperationWithFolder:number:partID:encoding:urgent:

Returns an operation to fetch an attachment.

- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentOperationWithFolder:(NSString *)folder number:(uint32_t)number partID:(NSString *)partID encoding:(MCOEncoding)encoding urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentOperationWithFolder:@"INBOX"
                                                                                         uid:456
                                                                                      partID:@"1.2"
                                                                                    encoding:MCOEncodingBase64
                                                                                      urgent:YES];
 [op start:^(NSError * error, NSData * partData) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageAttachmentOperationWithFolder:uid:partID:encoding:

Returns an operation to fetch an attachment.

- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentOperationWithFolder:(NSString *)folder uid:(uint32_t)uid partID:(NSString *)partID encoding:(MCOEncoding)encoding

Discussion

Example 1:

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentOperationWithFolder:@"INBOX"
                                                                                    uid:456
                                                                                 partID:@"1.2"
                                                                               encoding:MCOEncodingBase64];
 [op start:^(NSError * error, NSData * partData) {
 }];

Example 2:

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentOperationWithFolder:@"INBOX"
                                                                                    uid:[message uid]
                                                                                 partID:[part partID]
                                                                               encoding:[part encoding]];
 [op start:^(NSError * error, NSData * partData) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageAttachmentOperationWithFolder:uid:partID:encoding:urgent:

Returns an operation to fetch an attachment.

- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentOperationWithFolder:(NSString *)folder uid:(uint32_t)uid partID:(NSString *)partID encoding:(MCOEncoding)encoding urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

 MCOIMAPFetchContentOperation * op = [session fetchMessageAttachmentOperationWithFolder:@"INBOX"
                                                                                         uid:456
                                                                                      partID:@"1.2"
                                                                                    encoding:MCOEncodingBase64
                                                                                      urgent:YES];
 [op start:^(NSError * error, NSData * partData) {
 }];

Declared In

MCOIMAPSession.h

fetchMessageByUIDOperationWithFolder:uid:

Returns an operation to fetch the content of a message.

- (MCOIMAPFetchContentOperation *)fetchMessageByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uid

Discussion

 MCOIMAPFetchContentOperation * op = [session fetchMessageByUIDOperationWithFolder:@"INBOX" uid:456];
 [op start:^(NSError * error, NSData * messageData) {
    MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
 }];

Declared In

MCOIMAPSession.h

fetchMessageByUIDOperationWithFolder:uid:urgent:

Returns an operation to fetch the content of a message.

- (MCOIMAPFetchContentOperation *)fetchMessageByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uid urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

 MCOIMAPFetchContentOperation * op = [session fetchMessageByUIDOperationWithFolder:@"INBOX" uid:456 urgent:NO];
 [op start:^(NSError * error, NSData * messageData) {
    MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
 }];

Declared In

MCOIMAPSession.h

fetchMessageOperationWithFolder:number:

Returns an operation to fetch the content of a message, using IMAP sequence number.

- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder number:(uint32_t)number

Discussion

 MCOIMAPFetchContentOperation * op = [session fetchMessageOperationWithFolder:@"INBOX" number:42];
 [op start:^(NSError * error, NSData * messageData) {
    MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
 }];

Declared In

MCOIMAPSession.h

fetchMessageOperationWithFolder:number:urgent:

Returns an operation to fetch the content of a message, using IMAP sequence number.

- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder number:(uint32_t)number urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

 MCOIMAPFetchContentOperation * op = [session fetchMessageOperationWithFolder:@"INBOX" number:42 urgent:NO];
 [op start:^(NSError * error, NSData * messageData) {
    MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
 }];

Declared In

MCOIMAPSession.h

fetchMessageOperationWithFolder:uid:

Returns an operation to fetch the content of a message.

- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uid

Discussion

 MCOIMAPFetchContentOperation * op = [session fetchMessageOperationWithFolder:@"INBOX" uid:456];
 [op start:^(NSError * error, NSData * messageData) {
    MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
 }];

Declared In

MCOIMAPSession.h

fetchMessageOperationWithFolder:uid:urgent:

Returns an operation to fetch the content of a message.

- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uid urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

 MCOIMAPFetchContentOperation * op = [session fetchMessageOperationWithFolder:@"INBOX" uid:456 urgent:NO];
 [op start:^(NSError * error, NSData * messageData) {
    MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
 }];

Declared In

MCOIMAPSession.h

fetchMessagesByNumberOperationWithFolder:requestKind:numbers:

Returns an operation to fetch messages by (sequence) number. For example: show 50 most recent uids. NSString folder = @“INBOX”; MCOIMAPFolderInfoOperation folderInfo = [session folderInfoOperation:folder];

- (MCOIMAPFetchMessagesOperation *)fetchMessagesByNumberOperationWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind numbers:(MCOIndexSet *)numbers

Discussion

 [folderInfo start:^(NSError *error, MCOIMAPFolderInfo *info) {
     int numberOfMessages = 50;
     numberOfMessages -= 1;
     MCOIndexSet *numbers = [MCOIndexSet indexSetWithRange:MCORangeMake([info messageCount] - numberOfMessages, numberOfMessages)];

     MCOIMAPFetchMessagesOperation *fetchOperation = [session fetchMessagesByNumberOperationWithFolder:folder
                                                                                           requestKind:MCOIMAPMessagesRequestKindUid
                                                                                               numbers:numbers];

     [fetchOperation start:^(NSError *error, NSArray *messages, MCOIndexSet *vanishedMessages) {
         for (MCOIMAPMessage * message in messages) {
             NSLog(@"%u", [message uid]);
         }
     }];
 }];

Declared In

MCOIMAPSession.h

fetchMessagesByUIDOperationWithFolder:requestKind:uids:

Returns an operation to fetch messages by UID.

- (MCOIMAPFetchMessagesOperation *)fetchMessagesByUIDOperationWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind uids:(MCOIndexSet *)uids

Discussion

 MCOIMAPFetchMessagesOperation * op = [session fetchMessagesByUIDOperationWithFolder:@"INBOX"
                                                                         requestKind:MCOIMAPMessagesRequestKindHeaders | MCOIMAPMessagesRequestKindStructure
                                                                                uids:MCORangeMake(1, UINT64_MAX)];
 [op start:^(NSError * error, NSArray * messages, MCOIndexSet * vanishedMessages) {
    for(MCOIMAPMessage * msg in messages) {
      NSLog(@"%lu: %@", [msg uid], [msg header]);
    }
 }];

Declared In

MCOIMAPSession.h

fetchMessagesOperationWithFolder:requestKind:uids:

Returns an operation to fetch messages by UID.

- (MCOIMAPFetchMessagesOperation *)fetchMessagesOperationWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind uids:(MCOIndexSet *)uids

Discussion

 MCOIMAPFetchMessagesOperation * op = [session fetchMessagesOperationWithFolder:@"INBOX"
                                                                    requestKind:MCOIMAPMessagesRequestKindHeaders | MCOIMAPMessagesRequestKindStructure
                                                                           uids:MCORangeMake(1, UINT64_MAX)];
 [op start:^(NSError * error, NSArray * messages, MCOIndexSet * vanishedMessages) {
    for(MCOIMAPMessage * msg in messages) {
      NSLog(@"%lu: %@", [msg uid], [msg header]);
    }
 }];

Declared In

MCOIMAPSession.h

fetchNamespaceOperation

Returns an operation to fetch the list of namespaces.

- (MCOIMAPFetchNamespaceOperation *)fetchNamespaceOperation

Discussion

 MCOIMAPFetchNamespaceOperation * op = [session fetchNamespaceOperation];
 [op start:^(NSError * error, NSDictionary * namespaces) {
   if (error != nil)
     return;
   MCOIMAPNamespace * ns = [namespace objectForKey:MCOIMAPNamespacePersonal];
   NSString * path = [ns pathForComponents:[NSArray arrayWithObject:]];
   MCOIMAPOperation * createOp = [session createFolderOperation:foobar];
   [createOp start:^(NSError * error) {
   }];
 }];

Declared In

MCOIMAPSession.h

fetchParsedMessageOperationWithFolder:number:

Returns an operation to fetch the parsed content of a message, using IMAP sequence number.

- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder number:(uint32_t)number

Discussion

MCOIMAPFetchParsedContentOperation * op = [session fetchParsedMessageOperationWithFolder:@“INBOX” number:42]; [op start:^(NSError * error, MCOMessageParser * parser) {

}];

Declared In

MCOIMAPSession.h

fetchParsedMessageOperationWithFolder:number:urgent:

Returns an operation to fetch the parsed content of a message, using IMAP sequence number.

- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder number:(uint32_t)number urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

MCOIMAPFetchParsedContentOperation * op = [session fetchParsedMessageOperationWithFolder:@“INBOX” number:42 urgent:NO]; [op start:^(NSError * error, MCOMessageParser * parser) {

}];

Declared In

MCOIMAPSession.h

fetchParsedMessageOperationWithFolder:uid:

Returns an operation to fetch the parsed content of a message.

- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uid

Discussion

MCOIMAPFetchParsedContentOperation * op = [session fetchParsedMessageOperationWithFolder:@“INBOX” uid:456]; [op start:^(NSError * error, MCOMessageParser * parser) {

}];

Declared In

MCOIMAPSession.h

fetchParsedMessageOperationWithFolder:uid:urgent:

Returns an operation to fetch the parsed content of a message.

- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uid urgent:(BOOL)urgent

Parameters

urgent

is set to YES, an additional connection to the same folder might be opened to fetch the content.

MCOIMAPFetchParsedContentOperation * op = [session fetchParsedMessageOperationWithFolder:@“INBOX” uid:456 urgent:NO]; [op start:^(NSError * error, MCOMessageParser * parser) {

}];

Declared In

MCOIMAPSession.h

fetchSubscribedFoldersOperation

Returns an operation that gets the list of subscribed folders.

- (MCOIMAPFetchFoldersOperation *)fetchSubscribedFoldersOperation

Discussion

MCOIMAPFetchFoldersOperation * op = [session fetchSubscribedFoldersOperation];
[op start:^(NSError * error, NSArray * folders) {
}];

Declared In

MCOIMAPSession.h

folderInfoOperation:

Returns an operation that retrieves folder metadata (like UIDNext)

- (MCOIMAPFolderInfoOperation *)folderInfoOperation:(NSString *)folder

Discussion

 MCOIMAPFolderInfoOperation * op = [session folderInfoOperation:@"INBOX"];
 [op start:^(NSError *error, MCOIMAPFolderInfo * info) {
      NSLog(@"UIDNEXT: %lu", (unsigned long) [info uidNext]);
      NSLog(@"UIDVALIDITY: %lu", (unsigned long) [info uidValidity]);
      NSLog(@"HIGHESTMODSEQ: %llu", (unsigned long long) [info modSequenceValue]);
      NSLog(@"messages count: %lu", [info messageCount]);
 }];

Declared In

MCOIMAPSession.h

folderStatusOperation:

Returns an operation that retrieves folder status (like UIDNext - Unseen -)

- (MCOIMAPFolderStatusOperation *)folderStatusOperation:(NSString *)folder

Discussion

MCOIMAPFolderStatusOperation * op = [session folderStatusOperation:@"INBOX"];
[op start:^(NSError *error, MCOIMAPFolderStatus * info) {
    NSLog(@"UIDNEXT: %lu", (unsigned long) [info uidNext]);
    NSLog(@"UIDVALIDITY: %lu", (unsigned long) [info uidValidity]);
    NSLog(@"messages count: %lu", [info totalMessages]);
}];

Declared In

MCOIMAPSession.h

htmlBodyRenderingOperationWithMessage:folder:

Returns an operation to render the HTML body of a message to be displayed in a web view.

- (MCOIMAPMessageRenderingOperation *)htmlBodyRenderingOperationWithMessage:(MCOIMAPMessage *)message folder:(NSString *)folder

Discussion

MCOIMAPMessageRenderingOperation * op = [session htmlBodyRenderingOperationWithMessage:msg
                                                                                folder:@"INBOX"];

[op start:^(NSString * htmlString, NSError * error) {
}];

Declared In

MCOIMAPSession.h

htmlRenderingOperationWithMessage:folder:

Returns an operation to render the HTML version of a message to be displayed in a web view.

- (MCOIMAPMessageRenderingOperation *)htmlRenderingOperationWithMessage:(MCOIMAPMessage *)message folder:(NSString *)folder

Discussion

MCOIMAPMessageRenderingOperation * op = [session htmlRenderingOperationWithMessage:msg
                                                                        folder:@"INBOX"];

[op start:^(NSString * htmlString, NSError * error) {
}];

Declared In

MCOIMAPSession.h

identityOperationWithClientIdentity:

Returns an operation to send the client or get the server identity.

- (MCOIMAPIdentityOperation *)identityOperationWithClientIdentity:(MCOIMAPIdentity *)identity

Discussion

 MCOIMAPIdentity * identity = [MCOIMAPIdentity identityWithVendor:@"Mozilla" name:@"Thunderbird" version:@"17.0.5"];
 MCOIMAPIdentityOperation * op = [session identityOperationWithClientIdentity:identity];
 [op start:^(NSError * error, NSDictionary * serverIdentity) {
 }];

Declared In

MCOIMAPSession.h

idleOperationWithFolder:lastKnownUID:

Returns an operation to wait for something to happen in the folder. See RFC2177 for me info.

- (MCOIMAPIdleOperation *)idleOperationWithFolder:(NSString *)folder lastKnownUID:(uint32_t)lastKnownUID

Discussion

 MCOIMAPIdleOperation * op = [session idleOperationWithFolder:@"INBOX"
                                                 lastKnownUID:0];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

noopOperation

Returns an operation that will perform a No-Op operation on the given IMAP server.

- (MCOIMAPOperation *)noopOperation

Discussion

MCOIMAPOperation * op = [session noopOperation]; [op start:^(NSError * error) { }];

Declared In

MCOIMAPSession.h

plainTextBodyRenderingOperationWithMessage:folder:

Returns an operation to render the plain text body of a message. All end of line will be removed and white spaces cleaned up. This method can be used to generate the summary of the message.

- (MCOIMAPMessageRenderingOperation *)plainTextBodyRenderingOperationWithMessage:(MCOIMAPMessage *)message folder:(NSString *)folder

Discussion

MCOIMAPMessageRenderingOperation * op = [session plainTextBodyRenderingOperationWithMessage:msg folder:@“INBOX”];

[op start:^(NSString * htmlString, NSError * error) { }];

Declared In

MCOIMAPSession.h

plainTextBodyRenderingOperationWithMessage:folder:stripWhitespace:

Returns an operation to render the plain text body of a message. All end of line will be removed and white spaces cleaned up if requested. This method can be used to generate the summary of the message.

- (MCOIMAPMessageRenderingOperation *)plainTextBodyRenderingOperationWithMessage:(MCOIMAPMessage *)message folder:(NSString *)folder stripWhitespace:(BOOL)stripWhitespace

Discussion

MCOIMAPMessageRenderingOperation * op = [session plainTextBodyRenderingOperationWithMessage:msg
                                                                                     folder:@"INBOX"
                                                                            stripWhitespace:YES];

[op start:^(NSString * htmlString, NSError * error) {
}];

Declared In

MCOIMAPSession.h

plainTextRenderingOperationWithMessage:folder:

Returns an operation to render the plain text version of a message.

- (MCOIMAPMessageRenderingOperation *)plainTextRenderingOperationWithMessage:(MCOIMAPMessage *)message folder:(NSString *)folder

Discussion

MCOIMAPMessageRenderingOperation * op = [session plainTextRenderingOperationWithMessage:msg
                                                                                 folder:@"INBOX"];

[op start:^(NSString * htmlString, NSError * error) {
}];

Declared In

MCOIMAPSession.h

renameFolderOperation:otherName:

Creates an operation for renaming a folder

- (MCOIMAPOperation *)renameFolderOperation:(NSString *)folder otherName:(NSString *)otherName

Discussion

 MCOIMAPOperation * op = [session renameFolderOperation:@"my documents" otherName:@"Documents"];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

searchExpressionOperationWithFolder:expression:

Returns an operation to search for messages.

- (MCOIMAPSearchOperation *)searchExpressionOperationWithFolder:(NSString *)folder expression:(MCOIMAPSearchExpression *)expression

Discussion

 MCOIMAPSearchExpression * expr = [MCOIMAPSearchExpression searchFrom:@"laura@etpan.org"]
 MCOIMAPSearchOperation * op = [session searchExpressionOperationWithFolder:@"INBOX"
                                                                 expression:expr];
 [op start:^(NSError * error, MCOIndexSet * searchResult) {
 }];

Declared In

MCOIMAPSession.h

searchOperationWithFolder:kind:searchString:

Returns an operation to search for messages with a simple match.

- (MCOIMAPSearchOperation *)searchOperationWithFolder:(NSString *)folder kind:(MCOIMAPSearchKind)kind searchString:(NSString *)searchString

Discussion

 MCOIMAPSearchOperation * op = [session searchOperationWithFolder:@"INBOX"
                                                             kind:MCOIMAPSearchKindFrom
                                                     searchString:@"laura"];
 [op start:^(NSError * error, MCOIndexSet * searchResult) {
 }];

Declared In

MCOIMAPSession.h

storeFlagsOperationWithFolder:numbers:kind:flags:

Returns an operation to change flags of messages, using IMAP sequence number.

- (MCOIMAPOperation *)storeFlagsOperationWithFolder:(NSString *)folder numbers:(MCOIndexSet *)numbers kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flags

Discussion

For example: Adds the seen flag to the message with the sequence number number 42.

 MCOIMAPOperation * op = [session storeFlagsOperationWithFolder:@"INBOX"
                                                        numbers:[MCOIndexSet indexSetWithIndex:42]
                                                           kind:MCOIMAPStoreFlagsRequestKindAdd
                                                          flags:MCOMessageFlagSeen];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

storeFlagsOperationWithFolder:numbers:kind:flags:customFlags:

Returns an operation to change flags and custom flags of messages, using IMAP sequence number.

- (MCOIMAPOperation *)storeFlagsOperationWithFolder:(NSString *)folder numbers:(MCOIndexSet *)numbers kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flags customFlags:(NSArray *)customFlags

Discussion

For example: Adds the seen flag and $CNS-Greeting-On flag to the message with the sequence number 42.

 MCOIMAPOperation * op = [session storeFlagsOperationWithFolder:@"INBOX"
                                                        numbers:[MCOIndexSet indexSetWithIndex:42]
                                                           kind:MCOIMAPStoreFlagsRequestKindAdd
                                                          flags:MCOMessageFlagSeen
                                                    customFlags:@["$CNS-Greeting-On"]];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

storeFlagsOperationWithFolder:uids:kind:flags:

Returns an operation to change flags of messages.

- (MCOIMAPOperation *)storeFlagsOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flags

Discussion

For example: Adds the seen flag to the message with UID 456.

 MCOIMAPOperation * op = [session storeFlagsOperationWithFolder:@"INBOX"
                                                           uids:[MCOIndexSet indexSetWithIndex:456]
                                                           kind:MCOIMAPStoreFlagsRequestKindAdd
                                                          flags:MCOMessageFlagSeen];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

storeFlagsOperationWithFolder:uids:kind:flags:customFlags:

Returns an operation to change flags and custom flags of messages.

- (MCOIMAPOperation *)storeFlagsOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flags customFlags:(NSArray *)customFlags

Discussion

For example: Adds the seen flag and $CNS-Greeting-On flag to the message with UID 456.

 MCOIMAPOperation * op = [session storeFlagsOperationWithFolder:@"INBOX"
                                                           uids:[MCOIndexSet indexSetWithIndex:456]
                                                           kind:MCOIMAPStoreFlagsRequestKindAdd
                                                          flags:MCOMessageFlagSeen
                                                    customFlags:@["$CNS-Greeting-On"]];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

storeLabelsOperationWithFolder:numbers:kind:labels:

Returns an operation to change labels of messages. Intended for Gmail

- (MCOIMAPOperation *)storeLabelsOperationWithFolder:(NSString *)folder numbers:(MCOIndexSet *)numbers kind:(MCOIMAPStoreFlagsRequestKind)kind labels:(NSArray *)labels

Discussion

For example: Adds the label “Home” flag to the message with UID 42.

 MCOIMAPOperation * op = [session storeLabelsOperationWithFolder:@"INBOX"
                                                         numbers:[MCOIndexSet indexSetWithIndex:42]
                                                            kind:MCOIMAPStoreFlagsRequestKindAdd
                                                          labels:[NSArray arrayWithObject:@"Home"]];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

storeLabelsOperationWithFolder:uids:kind:labels:

Returns an operation to change labels of messages. Intended for Gmail

- (MCOIMAPOperation *)storeLabelsOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids kind:(MCOIMAPStoreFlagsRequestKind)kind labels:(NSArray *)labels

Discussion

For example: Adds the label “Home” flag to the message with UID 456.

 MCOIMAPOperation * op = [session storeLabelsOperationWithFolder:@"INBOX"
                                                            uids:[MCOIndexSet indexSetWithIndex:456]
                                                            kind:MCOIMAPStoreFlagsRequestKindAdd
                                                          labels:[NSArray arrayWithObject:@"Home"]];
 [op start:^(NSError * error) {
 }];

Declared In

MCOIMAPSession.h

subscribeFolderOperation:

Returns an operation to subscribe to a folder.

- (MCOIMAPOperation *)subscribeFolderOperation:(NSString *)folder

Discussion

 MCOIMAPOperation * op = [session createFolderOperation:@"holidays 2013"];
 [op start:^(NSError * error) {
   if (error != nil)
     return;
   MCOIMAPOperation * op = [session subscribeFolderOperation:@"holidays 2013"];
 }];

Declared In

MCOIMAPSession.h

syncMessagesByUIDWithFolder:requestKind:uids:modSeq:

Returns an operation to sync the last changes related to the given message list given a modSeq.

- (MCOIMAPFetchMessagesOperation *)syncMessagesByUIDWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind uids:(MCOIndexSet *)uids modSeq:(uint64_t)modSeq

Discussion

 MCOIMAPFetchMessagesOperation * op = [session syncMessagesByUIDWithFolder:@"INBOX"
                                                               requestKind:MCOIMAPMessagesRequestKindUID
                                                                      uids:MCORangeMake(1, UINT64_MAX)
                                                                    modSeq:lastModSeq];
 [op start:^(NSError * error, NSArray * messages, MCOIndexSet * vanishedMessages) {
   NSLog(@"added or modified messages: %@", messages);
   NSLog(@"deleted messages: %@", vanishedMessages);
 }];

@warn Important: This is only for servers that support Conditional Store. See RFC4551 vanishedMessages will be set only for servers that support QRESYNC. See RFC5162

Declared In

MCOIMAPSession.h

syncMessagesWithFolder:requestKind:uids:modSeq:

Returns an operation to sync the last changes related to the given message list given a modSeq.

- (MCOIMAPFetchMessagesOperation *)syncMessagesWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind uids:(MCOIndexSet *)uids modSeq:(uint64_t)modSeq

Discussion

 MCOIMAPFetchMessagesOperation * op = [session syncMessagesWithFolder:@"INBOX"
                                                          requestKind:MCOIMAPMessagesRequestKindUID
                                                                 uids:MCORangeMake(1, UINT64_MAX)
                                                               modSeq:lastModSeq];
 [op start:^(NSError * error, NSArray * messages, MCOIndexSet * vanishedMessages) {
   NSLog(@"added or modified messages: %@", messages);
   NSLog(@"deleted messages: %@", vanishedMessages);
 }];

@warn Important: This is only for servers that support Conditional Store. See RFC4551 vanishedMessages will be set only for servers that support QRESYNC. See RFC5162

Declared In

MCOIMAPSession.h

unsubscribeFolderOperation:

Returns an operation to unsubscribe from a folder.

- (MCOIMAPOperation *)unsubscribeFolderOperation:(NSString *)folder

Discussion

 MCOIMAPOperation * op = [session unsubscribeFolderOperation:@"holidays 2009"];
 [op start:^(NSError * error) {
   if (error != nil)
     return;
   MCOIMAPOperation * op = [session deleteFolderOperation:@"holidays 2009"]
 }];

Declared In

MCOIMAPSession.h