diff options
author | CodaFi <devteam.codafi@gmail.com> | 2014-08-17 11:48:31 -0600 |
---|---|---|
committer | CodaFi <devteam.codafi@gmail.com> | 2014-08-17 11:48:31 -0600 |
commit | 74afdabf89dbe93aceb88a517eab3270312e1e63 (patch) | |
tree | 59597cda1bda60773005b03f43bef85cd5b7502d /src/objc/nntp | |
parent | e0cf9bdd572cc76e3a55eb4cd68defd9a08f83fc (diff) |
Remove ArticleInfo
Diffstat (limited to 'src/objc/nntp')
-rw-r--r-- | src/objc/nntp/MCONNTP.h | 1 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPArticleInfo.h | 31 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPArticleInfo.mm | 71 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPFetchArticleOperation.h | 4 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPFetchArticlesOperation.h | 11 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPFetchArticlesOperation.mm | 6 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPSession.h | 10 |
7 files changed, 15 insertions, 119 deletions
diff --git a/src/objc/nntp/MCONNTP.h b/src/objc/nntp/MCONNTP.h index a1328166..980d0c39 100644 --- a/src/objc/nntp/MCONNTP.h +++ b/src/objc/nntp/MCONNTP.h @@ -16,7 +16,6 @@ #include <MailCore/MCONNTPFetchArticleOperation.h> #include <MailCore/MCONNTPFetchArticlesOperation.h> #include <MailCore/MCONNTPListNewsgroupsOperation.h> -#include <MailCore/MCONNTPArticleInfo.h> #include <MailCore/MCONNTPGroupInfo.h> #endif diff --git a/src/objc/nntp/MCONNTPArticleInfo.h b/src/objc/nntp/MCONNTPArticleInfo.h deleted file mode 100644 index 5e2a6887..00000000 --- a/src/objc/nntp/MCONNTPArticleInfo.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// MCONNTPArticleInfo.h -// mailcore2 -// -// Created by Robert Widmann on 8/13/14. -// Copyright (c) 2014 MailCore. All rights reserved. -// - -#ifndef MAILCORE_MCONNTPARTICLEINFO_H - -#define MAILCORE_MCONNTPARTICLEINFO_H - -#import <Foundation/Foundation.h> - -/** This is information of a message fetched by MCONNTPFetchArticlesOperation.*/ - -@interface MCONNTPArticleInfo : NSObject <NSCopying> - -/** This is the index of a given message.*/ -@property (nonatomic, assign) unsigned int index; - -/** This is the size of the given message.*/ -@property (nonatomic, assign) unsigned int size; - -/** This is the unique identifier of the message. - It can be used as a cache identifier.*/ -@property (nonatomic, copy) NSString * uid; - -@end - -#endif diff --git a/src/objc/nntp/MCONNTPArticleInfo.mm b/src/objc/nntp/MCONNTPArticleInfo.mm deleted file mode 100644 index 61f226f8..00000000 --- a/src/objc/nntp/MCONNTPArticleInfo.mm +++ /dev/null @@ -1,71 +0,0 @@ -// -// MCONNTPArticleInfo.m -// mailcore2 -// -// Created by Robert Widmann on 8/13/14. -// Copyright (c) 2014 MailCore. All rights reserved. -// - -#import "MCONNTPArticleInfo.h" - -#include "MCAsyncNNTP.h" -#include "MCNNTP.h" - -#import "MCOUtils.h" - -@implementation MCONNTPArticleInfo { - mailcore::NNTPArticleInfo * _nativeInfo; -} - -#define nativeType mailcore::NNTPArticleInfo - -+ (void) load -{ - MCORegisterClass(self, &typeid(nativeType)); -} - -- (id) copyWithZone:(NSZone *)zone -{ - nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); - id result = [[self class] mco_objectWithMCObject:nativeObject]; - MC_SAFE_RELEASE(nativeObject); - return [result retain]; -} - -+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object -{ - mailcore::NNTPArticleInfo * folder = (mailcore::NNTPArticleInfo *) object; - return [[[self alloc] initWithMCNNTPArticleInfo:folder] autorelease]; -} - -- (mailcore::Object *) mco_mcObject -{ - return _nativeInfo; -} - -- (NSString *) description -{ - return MCO_OBJC_BRIDGE_GET(description); -} - -- (id) initWithMCNNTPArticleInfo:(mailcore::NNTPArticleInfo *)info -{ - self = [super init]; - - _nativeInfo = info; - _nativeInfo->retain(); - - return self; -} - -- (void) dealloc -{ - MC_SAFE_RELEASE(_nativeInfo); - [super dealloc]; -} - -MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setIndex, index) -MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setSize, size) -MCO_OBJC_SYNTHESIZE_STRING(setUid, uid) - -@end diff --git a/src/objc/nntp/MCONNTPFetchArticleOperation.h b/src/objc/nntp/MCONNTPFetchArticleOperation.h index c72351d9..b8bffcb0 100644 --- a/src/objc/nntp/MCONNTPFetchArticleOperation.h +++ b/src/objc/nntp/MCONNTPFetchArticleOperation.h @@ -6,9 +6,9 @@ // Copyright (c) 2014 MailCore. All rights reserved. // -#ifndef MAILCORE_MCONNTPFETCHMESSAGEOPERATION_H +#ifndef MAILCORE_MCONNTPFETCHARTICLEOPERATION_H -#define MAILCORE_MCONNTPFETCHMESSAGEOPERATION_H +#define MAILCORE_MCONNTPFETCHARTICLEOPERATION_H #import <Foundation/Foundation.h> #import <MailCore/MCONNTPOperation.h> diff --git a/src/objc/nntp/MCONNTPFetchArticlesOperation.h b/src/objc/nntp/MCONNTPFetchArticlesOperation.h index 6d2a9dab..35a0889d 100644 --- a/src/objc/nntp/MCONNTPFetchArticlesOperation.h +++ b/src/objc/nntp/MCONNTPFetchArticlesOperation.h @@ -6,15 +6,16 @@ // Copyright (c) 2014 MailCore. All rights reserved. // -#ifndef MAILCORE_MCONNTPFETCHMESSAGESOPERATION_H +#ifndef MAILCORE_MCONNTPFETCHARTICLESOPERATION_H -#define MAILCORE_MCONNTPFETCHMESSAGESOPERATION_H +#define MAILCORE_MCONNTPFETCHARTICLESOPERATION_H #import <Foundation/Foundation.h> #import <MailCore/MCONNTPOperation.h> -/** This is an asynchronous operation that will fetch the list of a messages on the NNTP3 account. */ +@class MCOIndexSet; +/** This is an asynchronous operation that will fetch the list of a messages on the NNTP server. */ @interface MCONNTPFetchArticlesOperation : MCONNTPOperation /** @@ -22,12 +23,12 @@ @param completionBlock Called when the operation is finished. - - On success `error` will be nil and `messages` will be an array of MCONNTPArticleInfo + - On success `error` will be nil and `articles` will be an index set of article numbers. - On failure, `error` will be set with `MCOErrorDomain` as domain and an error code available in MCOConstants.h, `messages` will be null */ -- (void) start:(void (^)(NSError * error, NSArray * /* MCONNTPArticleInfo */ messages))completionBlock; +- (void) start:(void (^)(NSError * error, MCOIndexSet * articles))completionBlock; @end diff --git a/src/objc/nntp/MCONNTPFetchArticlesOperation.mm b/src/objc/nntp/MCONNTPFetchArticlesOperation.mm index b7c4670e..6e13a5d2 100644 --- a/src/objc/nntp/MCONNTPFetchArticlesOperation.mm +++ b/src/objc/nntp/MCONNTPFetchArticlesOperation.mm @@ -13,7 +13,7 @@ #import "MCOOperation+Private.h" #import "MCOUtils.h" -typedef void (^CompletionType)(NSError *error, NSArray * messages); +typedef void (^CompletionType)(NSError *error, MCOIndexSet * articles); @implementation MCONNTPFetchArticlesOperation { CompletionType _completionBlock; @@ -38,7 +38,7 @@ typedef void (^CompletionType)(NSError *error, NSArray * messages); [super dealloc]; } -- (void) start:(void (^)(NSError *error, NSArray * messages))completionBlock +- (void) start:(void (^)(NSError *error, MCOIndexSet * articles))completionBlock { _completionBlock = [completionBlock copy]; [self start]; @@ -58,7 +58,7 @@ typedef void (^CompletionType)(NSError *error, NSArray * messages); nativeType *op = MCO_NATIVE_INSTANCE; if (op->error() == mailcore::ErrorNone) { - _completionBlock(nil, MCO_TO_OBJC(op->messages())); + _completionBlock(nil, MCO_TO_OBJC(op->articles())); } else { _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); } diff --git a/src/objc/nntp/MCONNTPSession.h b/src/objc/nntp/MCONNTPSession.h index 89795087..6712d9e4 100644 --- a/src/objc/nntp/MCONNTPSession.h +++ b/src/objc/nntp/MCONNTPSession.h @@ -66,12 +66,10 @@ /** @name Operations */ /** - Returns an operation that will fetch the list of messages. + Returns an operation that will fetch the list of article numbers. - MCONNTPFetchArticlesOperation * op = [session fetchMessagesOperation]; - [op start:^(NSError * error, NSArray * messages) { - // messages is an array of MCONNTPArticleInfo - // [info index] can be used as reference for a given message in the other operations. + MCONNTPFetchArticlesOperation * op = [session fetchArticlesOperation]; + [op start:^(NSError * error, MCOIndexSet * articles) { }]; */ - (MCONNTPFetchArticlesOperation *) fetchArticlesOperation:(NSString *)group; @@ -89,7 +87,7 @@ /** Returns an operation that will fetch the content of the given message. - MCONNTPFetchArticleOperation * op = [session fetchMessageOperationWithIndex:idx inGroup:@"Group"]; + MCONNTPFetchArticleOperation * op = [session fetchArticleOperationWithIndex:idx inGroup:@"Group"]; [op start:^(NSError * error, NSData * messageData) { // messageData is the RFC 822 formatted message data. }]; |