MCOIMAPSession Class Reference
| 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
-
hostnameproperty -
portproperty -
usernameproperty -
passwordproperty -
OAuth2Tokenproperty -
authTypeproperty -
connectionTypeproperty -
timeoutproperty -
checkCertificateEnabledproperty -
voIPEnabledproperty -
defaultNamespaceproperty -
clientIdentityproperty -
serverIdentityproperty -
gmailUserDisplayNameproperty -
allowsFolderConcurrentAccessEnabledproperty -
maximumConnectionsproperty -
connectionLoggerproperty -
dispatchQueueproperty -
operationQueueRunningproperty -
operationQueueRunningChangeBlockproperty -
– cancelAllOperations
Folder Operations
-
– folderInfoOperation: -
– folderStatusOperation: -
– fetchSubscribedFoldersOperation -
– fetchAllFoldersOperation -
– renameFolderOperation:otherName: -
– deleteFolderOperation: -
– createFolderOperation: -
– subscribeFolderOperation: -
– unsubscribeFolderOperation: -
– expungeOperation:
Message Actions
-
– appendMessageOperationWithFolder:messageData:flags: -
– appendMessageOperationWithFolder:messageData:flags:customFlags: -
– copyMessagesOperationWithFolder:uids:destFolder: -
– storeFlagsOperationWithFolder:uids:kind:flags: -
– storeFlagsOperationWithFolder:numbers:kind:flags: -
– storeFlagsOperationWithFolder:uids:kind:flags:customFlags: -
– storeFlagsOperationWithFolder:numbers:kind:flags:customFlags: -
– storeLabelsOperationWithFolder:numbers:kind:labels: -
– storeLabelsOperationWithFolder:uids:kind:labels:
Fetching Messages
-
– fetchMessagesByUIDOperationWithFolder:requestKind:uids: -
– fetchMessagesOperationWithFolder:requestKind:uids: -
– fetchMessagesByNumberOperationWithFolder:requestKind:numbers: -
– syncMessagesByUIDWithFolder:requestKind:uids:modSeq: -
– syncMessagesWithFolder:requestKind:uids:modSeq: -
– fetchMessageByUIDOperationWithFolder:uid:urgent: -
– fetchMessageByUIDOperationWithFolder:uid: -
– fetchMessageOperationWithFolder:uid:urgent: -
– fetchMessageOperationWithFolder:uid: -
– fetchMessageOperationWithFolder:number:urgent: -
– fetchMessageOperationWithFolder:number: -
– fetchParsedMessageOperationWithFolder:uid:urgent: -
– fetchParsedMessageOperationWithFolder:uid: -
– fetchParsedMessageOperationWithFolder:number:urgent: -
– fetchParsedMessageOperationWithFolder:number:
Fetching Attachment Operations
-
– fetchMessageAttachmentByUIDOperationWithFolder:uid:partID:encoding:urgent: -
– fetchMessageAttachmentByUIDOperationWithFolder:uid:partID:encoding: -
– fetchMessageAttachmentOperationWithFolder:uid:partID:encoding:urgent: -
– fetchMessageAttachmentOperationWithFolder:uid:partID:encoding: -
– fetchMessageAttachmentOperationWithFolder:number:partID:encoding:urgent: -
– fetchMessageAttachmentOperationWithFolder:number:partID:encoding:
General IMAP Actions
-
– idleOperationWithFolder:lastKnownUID: -
– fetchNamespaceOperation -
– identityOperationWithClientIdentity: -
– connectOperation -
– noopOperation -
– checkAccountOperation -
– capabilityOperation
Search Operations
Rendering Operations
Properties
OAuth2Token
This is the OAuth2 token.
@property (nonatomic, copy) NSString *OAuth2TokenDeclared In
MCOIMAPSession.hallowsFolderConcurrentAccessEnabled
When set to YES, the session is allowed open to open several connections to the same folder.
@property (nonatomic, assign) BOOL allowsFolderConcurrentAccessEnabledDiscussion
Warning: Some older IMAP servers don’t like this
Declared In
MCOIMAPSession.hauthType
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 authTypeDiscussion
Warning: Important: Over an encrypted connection like TLS, the password will still be secure
Declared In
MCOIMAPSession.hcheckCertificateEnabled
When set to YES, the connection will fail if the certificate is incorrect.
@property (nonatomic, assign, getter=isCheckCertificateEnabled) BOOL checkCertificateEnabledDeclared In
MCOIMAPSession.hclientIdentity
The identity of the IMAP client.
@property (nonatomic, strong, readonly) MCOIMAPIdentity *clientIdentityDeclared In
MCOIMAPSession.hconnectionLogger
Sets logger callback. The network traffic will be sent to this block.
@property (nonatomic, copy) MCOConnectionLogger connectionLoggerDiscussion
[session setConnectionLogger:^(void * connectionID, MCOConnectionLogType type, NSData * data) { NSLog(@“%@”, [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]); // … }];
Declared In
MCOIMAPSession.hconnectionType
This is the encryption type to use. See MCOConnectionType for more information.
@property (nonatomic, assign) MCOConnectionType connectionTypeDeclared In
MCOIMAPSession.hdefaultNamespace
The default namespace.
@property (nonatomic, strong) MCOIMAPNamespace *defaultNamespaceDeclared In
MCOIMAPSession.hdispatchQueue
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 dispatchQueueDeclared In
MCOIMAPSession.hgmailUserDisplayName
Display name of the Gmail user. It will be nil if it’s not a Gmail server.
@property (nonatomic, copy, readonly) NSString *gmailUserDisplayNameDeclared In
MCOIMAPSession.hhostname
This is the hostname of the IMAP server to connect to.
@property (nonatomic, copy) NSString *hostnameDeclared In
MCOIMAPSession.hmaximumConnections
Maximum number of connections to the server allowed.
@property (nonatomic, assign) unsigned int maximumConnectionsDeclared In
MCOIMAPSession.hoperationQueueRunning
The value will be YES when asynchronous operations are running, else it will return NO.
@property (nonatomic, assign, readonly, getter=isOperationQueueRunning) BOOL operationQueueRunningDeclared In
MCOIMAPSession.hoperationQueueRunningChangeBlock
Sets operation running callback. It will be called when operations start or stop running.
@property (nonatomic, copy) MCOOperationQueueRunningChangeBlock operationQueueRunningChangeBlockDiscussion
[session setOperationQueueRunningChangeBlock:^{ if ([session isOperationQueueRunning]) { } else { } }];
Declared In
MCOIMAPSession.hpassword
This is the password of the account.
@property (nonatomic, copy) NSString *passwordDeclared In
MCOIMAPSession.hport
This is the port of the IMAP server to connect to.
@property (nonatomic, assign) unsigned int portDeclared In
MCOIMAPSession.hserverIdentity
The identity of the IMAP server.
@property (nonatomic, strong, readonly) MCOIMAPIdentity *serverIdentityDeclared In
MCOIMAPSession.htimeout
This is the timeout of the connection.
@property (nonatomic, assign) NSTimeInterval timeoutDeclared In
MCOIMAPSession.hInstance Methods
appendMessageOperationWithFolder:messageData:flags:
Returns an operation to add a message to a folder.
- (MCOIMAPAppendMessageOperation *)appendMessageOperationWithFolder:(NSString *)folder messageData:(NSData *)messageData flags:(MCOMessageFlag)flagsDiscussion
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.happendMessageOperationWithFolder: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 *)customFlagsDiscussion
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.hcapabilityOperation
Returns an operation to request capabilities of the server. See MCOIMAPCapability for the list of capabilities.
- (MCOIMAPCapabilityOperation *)capabilityOperationDiscussion
canIdle = NO;
MCOIMAPCapabilityOperation * op = [session capabilityOperation];
[op start:^(NSError * error, MCOIndexSet * capabilities) {
if ([capabilities containsIndex:MCOIMAPCapabilityIdle]) {
canIdle = YES;
}
}];
Declared In
MCOIMAPSession.hcheckAccountOperation
Returns an operation that will check whether the IMAP account is valid.
- (MCOIMAPOperation *)checkAccountOperationDiscussion
MCOIMAPOperation * op = [session checkAccountOperation];
[op start:^(NSError * error) {
}];
Declared In
MCOIMAPSession.hconnectOperation
Returns an operation that will connect to the given IMAP server without authenticating. Useful for checking initial server capabilities.
- (MCOIMAPOperation *)connectOperationDiscussion
MCOIMAPOperation * op = [session connectOperation]; [op start:^(NSError * error) { }];
Declared In
MCOIMAPSession.hcopyMessagesOperationWithFolder:uids:destFolder:
Returns an operation to copy messages to a folder.
- (MCOIMAPCopyMessagesOperation *)copyMessagesOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids destFolder:(NSString *)destFolderDiscussion
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.hcreateFolderOperation:
Returns an operation that creates a new folder
- (MCOIMAPOperation *)createFolderOperation:(NSString *)folderDiscussion
MCOIMAPOperation * op = [session createFolderOperation:@"holidays 2013"];
[op start:^(NSError * error) {
}];
Declared In
MCOIMAPSession.hdeleteFolderOperation:
Create an operation for deleting a folder
- (MCOIMAPOperation *)deleteFolderOperation:(NSString *)folderDiscussion
MCOIMAPOperation * op = [session deleteFolderOperation:@"holidays 2009"];
[op start:^(NSError * error) {
}]];
Declared In
MCOIMAPSession.hdisconnectOperation
Returns an operation to disconnect the session. It will disconnect all the sockets created by the session.
- (MCOIMAPOperation *)disconnectOperationDiscussion
MCOIMAPOperation * op = [session disconnectOperation];
[op start:^(NSError * error) {
}];
Declared In
MCOIMAPSession.hexpungeOperation:
Returns an operation to expunge a folder.
- (MCOIMAPOperation *)expungeOperation:(NSString *)folderDiscussion
MCOIMAPOperation * op = [session expungeOperation:@"INBOX"];
[op start:^(NSError * error) {
}];
Declared In
MCOIMAPSession.hfetchAllFoldersOperation
Returns an operation that gets all folders
- (MCOIMAPFetchFoldersOperation *)fetchAllFoldersOperationDiscussion
MCOIMAPFetchFoldersOperation * op = [session fetchAllFoldersOperation];
[op start:^(NSError * error, NSArray *folders) {
}];
Declared In
MCOIMAPSession.hfetchMessageAttachmentByUIDOperationWithFolder:uid:partID:encoding:
Returns an operation to fetch an attachment.
- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uid partID:(NSString *)partID encoding:(MCOEncoding)encodingDiscussion
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.hfetchMessageAttachmentByUIDOperationWithFolder: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)urgentParameters
- 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.hfetchMessageAttachmentOperationWithFolder:number:partID:encoding:
Returns an operation to fetch an attachment.
- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentOperationWithFolder:(NSString *)folder number:(uint32_t)number partID:(NSString *)partID encoding:(MCOEncoding)encodingDiscussion
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.hfetchMessageAttachmentOperationWithFolder: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)urgentParameters
- 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.hfetchMessageAttachmentOperationWithFolder:uid:partID:encoding:
Returns an operation to fetch an attachment.
- (MCOIMAPFetchContentOperation *)fetchMessageAttachmentOperationWithFolder:(NSString *)folder uid:(uint32_t)uid partID:(NSString *)partID encoding:(MCOEncoding)encodingDiscussion
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.hfetchMessageAttachmentOperationWithFolder: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)urgentParameters
- 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.hfetchMessageByUIDOperationWithFolder:uid:
Returns an operation to fetch the content of a message.
- (MCOIMAPFetchContentOperation *)fetchMessageByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uidDiscussion
MCOIMAPFetchContentOperation * op = [session fetchMessageByUIDOperationWithFolder:@"INBOX" uid:456];
[op start:^(NSError * error, NSData * messageData) {
MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
}];
Declared In
MCOIMAPSession.hfetchMessageByUIDOperationWithFolder:uid:urgent:
Returns an operation to fetch the content of a message.
- (MCOIMAPFetchContentOperation *)fetchMessageByUIDOperationWithFolder:(NSString *)folder uid:(uint32_t)uid urgent:(BOOL)urgentParameters
- 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.hfetchMessageOperationWithFolder:number:
Returns an operation to fetch the content of a message, using IMAP sequence number.
- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder number:(uint32_t)numberDiscussion
MCOIMAPFetchContentOperation * op = [session fetchMessageOperationWithFolder:@"INBOX" number:42];
[op start:^(NSError * error, NSData * messageData) {
MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
}];
Declared In
MCOIMAPSession.hfetchMessageOperationWithFolder: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)urgentParameters
- 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.hfetchMessageOperationWithFolder:uid:
Returns an operation to fetch the content of a message.
- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uidDiscussion
MCOIMAPFetchContentOperation * op = [session fetchMessageOperationWithFolder:@"INBOX" uid:456];
[op start:^(NSError * error, NSData * messageData) {
MCOMessageParser * parser = [MCOMessageParser messageParserWithData:messageData]
}];
Declared In
MCOIMAPSession.hfetchMessageOperationWithFolder:uid:urgent:
Returns an operation to fetch the content of a message.
- (MCOIMAPFetchContentOperation *)fetchMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uid urgent:(BOOL)urgentParameters
- 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.hfetchMessagesByNumberOperationWithFolder: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 *)numbersDiscussion
[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.hfetchMessagesByUIDOperationWithFolder:requestKind:uids:
Returns an operation to fetch messages by UID.
- (MCOIMAPFetchMessagesOperation *)fetchMessagesByUIDOperationWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind uids:(MCOIndexSet *)uidsDiscussion
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.hfetchMessagesOperationWithFolder:requestKind:uids:
Returns an operation to fetch messages by UID.
- (MCOIMAPFetchMessagesOperation *)fetchMessagesOperationWithFolder:(NSString *)folder requestKind:(MCOIMAPMessagesRequestKind)requestKind uids:(MCOIndexSet *)uidsDiscussion
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.hfetchNamespaceOperation
Returns an operation to fetch the list of namespaces.
- (MCOIMAPFetchNamespaceOperation *)fetchNamespaceOperationDiscussion
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.hfetchParsedMessageOperationWithFolder:number:
Returns an operation to fetch the parsed content of a message, using IMAP sequence number.
- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder number:(uint32_t)numberDiscussion
MCOIMAPFetchParsedContentOperation * op = [session fetchParsedMessageOperationWithFolder:@“INBOX” number:42]; [op start:^(NSError * error, MCOMessageParser * parser) {
}];
Declared In
MCOIMAPSession.hfetchParsedMessageOperationWithFolder: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)urgentParameters
- 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.hfetchParsedMessageOperationWithFolder:uid:
Returns an operation to fetch the parsed content of a message.
- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uidDiscussion
MCOIMAPFetchParsedContentOperation * op = [session fetchParsedMessageOperationWithFolder:@“INBOX” uid:456]; [op start:^(NSError * error, MCOMessageParser * parser) {
}];
Declared In
MCOIMAPSession.hfetchParsedMessageOperationWithFolder:uid:urgent:
Returns an operation to fetch the parsed content of a message.
- (MCOIMAPFetchParsedContentOperation *)fetchParsedMessageOperationWithFolder:(NSString *)folder uid:(uint32_t)uid urgent:(BOOL)urgentParameters
- 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.hfetchSubscribedFoldersOperation
Returns an operation that gets the list of subscribed folders.
- (MCOIMAPFetchFoldersOperation *)fetchSubscribedFoldersOperationDiscussion
MCOIMAPFetchFoldersOperation * op = [session fetchSubscribedFoldersOperation];
[op start:^(NSError * error, NSArray * folders) {
}];
Declared In
MCOIMAPSession.hfolderInfoOperation:
Returns an operation that retrieves folder metadata (like UIDNext)
- (MCOIMAPFolderInfoOperation *)folderInfoOperation:(NSString *)folderDiscussion
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.hfolderStatusOperation:
Returns an operation that retrieves folder status (like UIDNext - Unseen -)
- (MCOIMAPFolderStatusOperation *)folderStatusOperation:(NSString *)folderDiscussion
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.hhtmlBodyRenderingOperationWithMessage: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 *)folderDiscussion
MCOIMAPMessageRenderingOperation * op = [session htmlBodyRenderingOperationWithMessage:msg
folder:@"INBOX"];
[op start:^(NSString * htmlString, NSError * error) {
}];
Declared In
MCOIMAPSession.hhtmlRenderingOperationWithMessage: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 *)folderDiscussion
MCOIMAPMessageRenderingOperation * op = [session htmlRenderingOperationWithMessage:msg
folder:@"INBOX"];
[op start:^(NSString * htmlString, NSError * error) {
}];
Declared In
MCOIMAPSession.hidentityOperationWithClientIdentity:
Returns an operation to send the client or get the server identity.
- (MCOIMAPIdentityOperation *)identityOperationWithClientIdentity:(MCOIMAPIdentity *)identityDiscussion
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.hidleOperationWithFolder: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)lastKnownUIDDiscussion
MCOIMAPIdleOperation * op = [session idleOperationWithFolder:@"INBOX"
lastKnownUID:0];
[op start:^(NSError * error) {
}];
Declared In
MCOIMAPSession.hnoopOperation
Returns an operation that will perform a No-Op operation on the given IMAP server.
- (MCOIMAPOperation *)noopOperationDiscussion
MCOIMAPOperation * op = [session noopOperation]; [op start:^(NSError * error) { }];
Declared In
MCOIMAPSession.hplainTextBodyRenderingOperationWithMessage: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 *)folderDiscussion
MCOIMAPMessageRenderingOperation * op = [session plainTextBodyRenderingOperationWithMessage:msg folder:@“INBOX”];
[op start:^(NSString * htmlString, NSError * error) { }];
Declared In
MCOIMAPSession.hplainTextBodyRenderingOperationWithMessage: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)stripWhitespaceDiscussion
MCOIMAPMessageRenderingOperation * op = [session plainTextBodyRenderingOperationWithMessage:msg
folder:@"INBOX"
stripWhitespace:YES];
[op start:^(NSString * htmlString, NSError * error) {
}];
Declared In
MCOIMAPSession.hplainTextRenderingOperationWithMessage:folder:
Returns an operation to render the plain text version of a message.
- (MCOIMAPMessageRenderingOperation *)plainTextRenderingOperationWithMessage:(MCOIMAPMessage *)message folder:(NSString *)folderDiscussion
MCOIMAPMessageRenderingOperation * op = [session plainTextRenderingOperationWithMessage:msg
folder:@"INBOX"];
[op start:^(NSString * htmlString, NSError * error) {
}];
Declared In
MCOIMAPSession.hrenameFolderOperation:otherName:
Creates an operation for renaming a folder
- (MCOIMAPOperation *)renameFolderOperation:(NSString *)folder otherName:(NSString *)otherNameDiscussion
MCOIMAPOperation * op = [session renameFolderOperation:@"my documents" otherName:@"Documents"];
[op start:^(NSError * error) {
}];
Declared In
MCOIMAPSession.hsearchExpressionOperationWithFolder:expression:
Returns an operation to search for messages.
- (MCOIMAPSearchOperation *)searchExpressionOperationWithFolder:(NSString *)folder expression:(MCOIMAPSearchExpression *)expressionDiscussion
MCOIMAPSearchExpression * expr = [MCOIMAPSearchExpression searchFrom:@"laura@etpan.org"]
MCOIMAPSearchOperation * op = [session searchExpressionOperationWithFolder:@"INBOX"
expression:expr];
[op start:^(NSError * error, MCOIndexSet * searchResult) {
}];
Declared In
MCOIMAPSession.hsearchOperationWithFolder:kind:searchString:
Returns an operation to search for messages with a simple match.
- (MCOIMAPSearchOperation *)searchOperationWithFolder:(NSString *)folder kind:(MCOIMAPSearchKind)kind searchString:(NSString *)searchStringDiscussion
MCOIMAPSearchOperation * op = [session searchOperationWithFolder:@"INBOX"
kind:MCOIMAPSearchKindFrom
searchString:@"laura"];
[op start:^(NSError * error, MCOIndexSet * searchResult) {
}];
Declared In
MCOIMAPSession.hstoreFlagsOperationWithFolder: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)flagsDiscussion
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.hstoreFlagsOperationWithFolder: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 *)customFlagsDiscussion
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.hstoreFlagsOperationWithFolder:uids:kind:flags:
Returns an operation to change flags of messages.
- (MCOIMAPOperation *)storeFlagsOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flagsDiscussion
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.hstoreFlagsOperationWithFolder: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 *)customFlagsDiscussion
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.hstoreLabelsOperationWithFolder: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 *)labelsDiscussion
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.hstoreLabelsOperationWithFolder: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 *)labelsDiscussion
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.hsubscribeFolderOperation:
Returns an operation to subscribe to a folder.
- (MCOIMAPOperation *)subscribeFolderOperation:(NSString *)folderDiscussion
MCOIMAPOperation * op = [session createFolderOperation:@"holidays 2013"];
[op start:^(NSError * error) {
if (error != nil)
return;
MCOIMAPOperation * op = [session subscribeFolderOperation:@"holidays 2013"];
}];
Declared In
MCOIMAPSession.hsyncMessagesByUIDWithFolder: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)modSeqDiscussion
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.hsyncMessagesWithFolder: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)modSeqDiscussion
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.hunsubscribeFolderOperation:
Returns an operation to unsubscribe from a folder.
- (MCOIMAPOperation *)unsubscribeFolderOperation:(NSString *)folderDiscussion
MCOIMAPOperation * op = [session unsubscribeFolderOperation:@"holidays 2009"];
[op start:^(NSError * error) {
if (error != nil)
return;
MCOIMAPOperation * op = [session deleteFolderOperation:@"holidays 2009"]
}];
Declared In
MCOIMAPSession.h