diff options
author | Daryle Walker <dwalker07@yahoo.com> | 2015-12-29 00:18:13 -0500 |
---|---|---|
committer | Daryle Walker <dwalker07@yahoo.com> | 2015-12-29 00:18:13 -0500 |
commit | 3a1641a7c7fbef9420fee48ba25b95fc94ef6673 (patch) | |
tree | d15953d6b62d78fcf22ac1c09a6fd6e94aef9921 | |
parent | a82888636dabb374686310801f526f1d5a782f92 (diff) |
Remove extraneous group parameter from fetch-article-by-message-ID methods.
-rw-r--r-- | src/async/nntp/MCNNTPFetchArticleOperation.cpp | 2 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.cpp | 12 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.h | 1 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPSession.h | 12 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPSession.mm | 8 |
5 files changed, 25 insertions, 10 deletions
diff --git a/src/async/nntp/MCNNTPFetchArticleOperation.cpp b/src/async/nntp/MCNNTPFetchArticleOperation.cpp index 5ebe1a81..eedf2fc9 100644 --- a/src/async/nntp/MCNNTPFetchArticleOperation.cpp +++ b/src/async/nntp/MCNNTPFetchArticleOperation.cpp @@ -65,7 +65,7 @@ void NNTPFetchArticleOperation::main() if (mMessageID == NULL) { mData = session()->session()->fetchArticle(mGroupName, mMessageIndex, this, &error); } else { - mData = session()->session()->fetchArticleByMessageID(mGroupName, mMessageID, &error); + mData = session()->session()->fetchArticleByMessageID(mMessageID, &error); } MC_SAFE_RETAIN(mData); setError(error); diff --git a/src/core/nntp/MCNNTPSession.cpp b/src/core/nntp/MCNNTPSession.cpp index f6427006..bc86ebbc 100644 --- a/src/core/nntp/MCNNTPSession.cpp +++ b/src/core/nntp/MCNNTPSession.cpp @@ -464,7 +464,7 @@ Data * NNTPSession::fetchArticle(String *groupName, unsigned int index, NNTPProg return result; } -Data * NNTPSession::fetchArticleByMessageID(String * groupName, String * messageID, ErrorCode * pError) +Data * NNTPSession::fetchArticleByMessageID(String * messageID, ErrorCode * pError) { int r; char * msgID; @@ -473,11 +473,6 @@ Data * NNTPSession::fetchArticleByMessageID(String * groupName, String * message MCLog("fetch article at message-id %s", messageID->UTF8Characters()); - selectGroup(groupName, pError); - if (* pError != ErrorNone) { - return NULL; - } - msgID = strdup(messageID->UTF8Characters()); r = newsnntp_article_by_message_id(mNNTP, msgID, &content, &content_len); @@ -498,6 +493,11 @@ Data * NNTPSession::fetchArticleByMessageID(String * groupName, String * message return result; } +Data * NNTPSession::fetchArticleByMessageID(String * groupName, String * messageID, ErrorCode * pError) +{ + return this->fetchArticleByMessageID(messageID, pError); +} + time_t NNTPSession::fetchServerDate(ErrorCode * pError) { int r; struct tm time; diff --git a/src/core/nntp/MCNNTPSession.h b/src/core/nntp/MCNNTPSession.h index dc2316ff..c39cf727 100644 --- a/src/core/nntp/MCNNTPSession.h +++ b/src/core/nntp/MCNNTPSession.h @@ -53,6 +53,7 @@ namespace mailcore { virtual IndexSet * fetchAllArticles(String * groupname, ErrorCode * pError); virtual Data * fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError); + virtual Data * fetchArticleByMessageID(String * messageID, ErrorCode * pError); virtual Data * fetchArticleByMessageID(String * groupname, String * messageID, ErrorCode * pError); virtual time_t fetchServerDate(ErrorCode * pError); diff --git a/src/objc/nntp/MCONNTPSession.h b/src/objc/nntp/MCONNTPSession.h index 0637ec7e..6b540947 100644 --- a/src/objc/nntp/MCONNTPSession.h +++ b/src/objc/nntp/MCONNTPSession.h @@ -138,12 +138,22 @@ /** Returns an operation that will fetch the content of a message with the given messageID. + MCONNTPFetchArticleOperation * op = [session fetchArticleOperationWithMessageID:@"<MessageID123@mail.google.com>"]; + [op start:^(NSError * __nullable error, NSData * messageData) { + // messageData is the RFC 822 formatted message data. + }]; + */ +- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID; + +/** + Obsolete. Use -fetchArticleOperationWithMessageID: instead. + MCONNTPFetchArticleOperation * op = [session fetchArticleOperationWithMessageID:@"<MessageID123@mail.google.com>" inGroup:@"comp.lang.c"]; [op start:^(NSError * __nullable error, NSData * messageData) { // messageData is the RFC 822 formatted message data. }]; */ -- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID inGroup:(NSString *)group; +- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID inGroup:(NSString * __nullable)group; /** Returns an operation that will fetch the server's date and time. diff --git a/src/objc/nntp/MCONNTPSession.mm b/src/objc/nntp/MCONNTPSession.mm index 374e6018..cc47ae5e 100644 --- a/src/objc/nntp/MCONNTPSession.mm +++ b/src/objc/nntp/MCONNTPSession.mm @@ -176,11 +176,15 @@ MCO_OBJC_SYNTHESIZE_SCALAR(dispatch_queue_t, dispatch_queue_t, setDispatchQueue, return MCO_TO_OBJC_OP(coreOp); } -- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID inGroup:(NSString *)group { - mailcore::NNTPFetchArticleOperation * coreOp = MCO_NATIVE_INSTANCE->fetchArticleByMessageIDOperation(MCO_FROM_OBJC(mailcore::String, group), MCO_FROM_OBJC(mailcore::String, messageID)); +- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID { + mailcore::NNTPFetchArticleOperation * coreOp = MCO_NATIVE_INSTANCE->fetchArticleByMessageIDOperation(MCO_FROM_OBJC(mailcore::String, messageID)); return MCO_TO_OBJC_OP(coreOp); } +- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID inGroup:(NSString * __nullable)group { + return [self fetchArticleOperationWithMessageID:messageID]; +} + - (MCONNTPFetchOverviewOperation *)fetchOverviewOperationWithIndexes:(MCOIndexSet *)indexes inGroup:(NSString *)group { mailcore::NNTPFetchOverviewOperation * coreOp = MCO_NATIVE_INSTANCE->fetchOverviewOperationWithIndexes(MCO_FROM_OBJC(mailcore::String, group), MCO_FROM_OBJC(mailcore::IndexSet, indexes)); return MCO_TO_OBJC_OP(coreOp); |