Inherits from NSObject
Declared in MCONNTPSession.h
MCONNTPSession.mm

Overview

This class implements asynchronous access to the NNTP protocol.

Properties

checkCertificateEnabled

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

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

Declared In

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

MCONNTPSession.h

connectionType

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

@property (nonatomic, assign) MCOConnectionType connectionType

Declared In

MCONNTPSession.h

dispatchQueue

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

@property (nonatomic, retain) dispatch_queue_t dispatchQueue

Declared In

MCONNTPSession.h

hostname

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

@property (nonatomic, copy) NSString *hostname

Declared In

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

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

MCONNTPSession.h

password

This is the password of the account.

@property (nonatomic, copy) NSString *password

Declared In

MCONNTPSession.h

port

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

@property (nonatomic, assign) unsigned int port

Declared In

MCONNTPSession.h

timeout

This is the timeout of the connection.

@property (nonatomic, assign) NSTimeInterval timeout

Declared In

MCONNTPSession.h

username

This is the username of the account.

@property (nonatomic, copy) NSString *username

Declared In

MCONNTPSession.h

Instance Methods

cancelAllOperations

Cancel all operations

- (void)cancelAllOperations

Declared In

MCONNTPSession.h

checkAccountOperation

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

- (MCONNTPOperation *)checkAccountOperation

Discussion

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

Declared In

MCONNTPSession.h

disconnectOperation

Returns an operation that will disconnect the session.

- (MCONNTPOperation *)disconnectOperation

Discussion

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

Declared In

MCONNTPSession.h

fetchAllArticlesOperation:

Returns an operation that will fetch the list of article numbers.

- (MCONNTPFetchAllArticlesOperation *)fetchAllArticlesOperation:(NSString *)group

Discussion

MCONNTPFetchAllArticlesOperation * op = [session fetchAllArticlesOperation:@“comp.lang.c”]; [op start:^(NSError * error, MCOIndexSet * articles) { }];

Declared In

MCONNTPSession.h

fetchArticleOperationWithIndex:inGroup:

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

- (MCONNTPFetchArticleOperation *)fetchArticleOperationWithIndex:(unsigned int)index inGroup:(NSString *)group

Discussion

MCONNTPFetchArticleOperation * op = [session fetchArticleOperationWithIndex:idx inGroup:@“comp.lang.c”]; [op start:^(NSError * error, NSData * messageData) { // messageData is the RFC 822 formatted message data. }];

Declared In

MCONNTPSession.h

fetchArticleOperationWithMessageID:inGroup:

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

- (MCONNTPFetchArticleOperation *)fetchArticleOperationWithMessageID:(NSString *)messageID inGroup:(NSString *)group

Discussion

MCONNTPFetchArticleOperation * op = [session fetchArticleOperationWithMessageID:@“MessageID123@mail.google.com” inGroup:@“comp.lang.c”]; [op start:^(NSError * error, NSData * messageData) { // messageData is the RFC 822 formatted message data. }];

Declared In

MCONNTPSession.h

fetchHeaderOperationWithIndex:inGroup:

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

- (MCONNTPFetchHeaderOperation *)fetchHeaderOperationWithIndex:(unsigned int)index inGroup:(NSString *)group

Discussion

MCONNTPFetchHeaderOperation * op = [session fetchHeaderOperationWithIndex:idx inGroup:@“comp.lang.c”]; [op start:^(NSError * error, MCOMessageHeader * header) { // header is the parsed header of the message. }];

Declared In

MCONNTPSession.h

fetchOverviewOperationWithIndexes:inGroup:

Returns an operation that will fetch an overview (headers) for a set of messages.

- (MCONNTPFetchOverviewOperation *)fetchOverviewOperationWithIndexes:(MCOIndexSet *)indexes inGroup:(NSString *)group

Discussion

MCONNTPFetchHeaderOperation * op = [session fetchOverviewOperationWithIndexes:indexes inGroup:@“comp.lang.c”]; [op start:^(NSError * error, NSArray * headers) { // headers are the parsed headers of each part of the overview. }];

Declared In

MCONNTPSession.h

fetchServerDateOperation

Returns an operation that will fetch the server’s date and time.

- (MCONNTPFetchServerTimeOperation *)fetchServerDateOperation

Discussion

MCONNTPFetchArticleOperation * op = [session fetchServerDateOperation]; [op start:^(NSError * error, NSDate * serverDate) { }];

Declared In

MCONNTPSession.h

listAllNewsgroupsOperation

Returns an operation that will list all available newsgroups.

- (MCONNTPListNewsgroupsOperation *)listAllNewsgroupsOperation

Discussion

MCONNTPListNewsgroupsOperation * op = [session listAllNewsgroupsOperation]; [op start:^(NSError * error, NSArray * subscribedGroups) { }];

Declared In

MCONNTPSession.h

listDefaultNewsgroupsOperation

Returns an operation that will list server-suggested default newsgroups.

- (MCONNTPListNewsgroupsOperation *)listDefaultNewsgroupsOperation

Discussion

MCONNTPListNewsgroupsOperation * op = [session listDefaultNewsgroupsOperation]; [op start:^(NSError * error, NSArray * defaultGroups) { }];

Declared In

MCONNTPSession.h