Inherits from NSObject
Declared in MCOPOPSession.h
MCOPOPSession.mm

Overview

This class implements asynchronous access to the POP3 protocol.

Properties

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

MCOPOPSession.h

checkCertificateEnabled

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

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

Declared In

MCOPOPSession.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) { }];

Declared In

MCOPOPSession.h

connectionType

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

@property (nonatomic, assign) MCOConnectionType connectionType

Declared In

MCOPOPSession.h

dispatchQueue

This property provides some hints to MCOPOPSession about where it’s called from. It will make MCOPOPSession 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 MCOPOPSession in the main thread.

@property (nonatomic, retain) dispatch_queue_t dispatchQueue

Declared In

MCOPOPSession.h

hostname

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

@property (nonatomic, copy) NSString *hostname

Declared In

MCOPOPSession.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

MCOPOPSession.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

MCOPOPSession.h

password

This is the password of the account.

@property (nonatomic, copy) NSString *password

Declared In

MCOPOPSession.h

port

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

@property (nonatomic, assign) unsigned int port

Declared In

MCOPOPSession.h

timeout

This is the timeout of the connection.

@property (nonatomic, assign) NSTimeInterval timeout

Declared In

MCOPOPSession.h

username

This is the username of the account.

@property (nonatomic, copy) NSString *username

Declared In

MCOPOPSession.h

Instance Methods

cancelAllOperations

Cancel all operations

- (void)cancelAllOperations

Declared In

MCOPOPSession.h

checkAccountOperation

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

- (MCOPOPOperation *)checkAccountOperation

Discussion

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

Declared In

MCOPOPSession.h

deleteMessagesOperationWithIndexes:

Returns an operation that will delete the given messages. Will disconnect when finished.

- (MCOPOPOperation *)deleteMessagesOperationWithIndexes:(MCOIndexSet *)indexes

Discussion

 MCOIndexSet * indexes = [MCOIndexSet indexSet];
 [indexes addIndex:1];
 [indexes addIndex:2];
 [indexes addIndex:3];
 MCOPOPOperation * op = [session deleteMessagesOperationWithIndexes:indexes];
 [op start:^(NSError * error) {
 }];

Declared In

MCOPOPSession.h

disconnectOperation

Returns an operation that will disconnect the session.

- (MCOPOPOperation *)disconnectOperation

Discussion

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

Declared In

MCOPOPSession.h

fetchHeaderOperationWithIndex:

Returns an operation that will fetch the header of the given message.

- (MCOPOPFetchHeaderOperation *)fetchHeaderOperationWithIndex:(unsigned int)index

Discussion

 MCOPOPFetchHeaderOperation * op = [session fetchHeaderOperationWithIndex:idx];
 [op start:^(NSError * error, MCOMessageHeader * header) {
      // header is the parsed header of the message.
 }];

Declared In

MCOPOPSession.h

fetchMessageOperationWithIndex:

Returns an operation that will fetch the content of the given message.

- (MCOPOPFetchMessageOperation *)fetchMessageOperationWithIndex:(unsigned int)index

Discussion

 MCOPOPFetchMessageOperation * op = [session fetchMessageOperationWithIndex:idx];
 [op start:^(NSError * error, NSData * messageData) {
      // messageData is the RFC 822 formatted message data.
 }];

Declared In

MCOPOPSession.h

fetchMessagesOperation

Returns an operation that will fetch the list of messages.

- (MCOPOPFetchMessagesOperation *)fetchMessagesOperation

Discussion

 MCOPOPFetchMessagesOperation * op = [session fetchMessagesOperation];
 [op start:^(NSError * error, NSArray * messages) {
    // messages is an array of MCOPOPMessageInfo
    // [info index] can be used as reference for a given message in the other operations.
 }];

Declared In

MCOPOPSession.h

noopOperation

Returns an operation that will perform a No-Op operation.

- (MCOPOPOperation *)noopOperation

Discussion

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

Declared In

MCOPOPSession.h