diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/nntp/MCNNTP.h | 1 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPArticleInfo.cc | 78 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPArticleInfo.h | 42 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.cc | 20 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.h | 7 |
5 files changed, 5 insertions, 143 deletions
diff --git a/src/core/nntp/MCNNTP.h b/src/core/nntp/MCNNTP.h index dd18a961..c2da3a66 100644 --- a/src/core/nntp/MCNNTP.h +++ b/src/core/nntp/MCNNTP.h @@ -3,7 +3,6 @@ #define MAILCORE_MCNNTP_H #include <MailCore/MCNNTPGroupInfo.h> -#include <MailCore/MCNNTPArticleInfo.h> #include <MailCore/MCNNTPProgressCallback.h> #include <MailCore/MCNNTPSession.h> diff --git a/src/core/nntp/MCNNTPArticleInfo.cc b/src/core/nntp/MCNNTPArticleInfo.cc deleted file mode 100644 index e3f05998..00000000 --- a/src/core/nntp/MCNNTPArticleInfo.cc +++ /dev/null @@ -1,78 +0,0 @@ -// -// MCNNTPArticleInfo.cpp -// mailcore2 -// -// Created by Robert Widmann on 3/6/14. -// Copyright (c) 2014 MailCore. All rights reserved. -// - -#include "MCNNTPArticleInfo.h" - -using namespace mailcore; - - -void NNTPArticleInfo::init() -{ - mIndex = 0; - mSize = 0; - mUid = NULL; -} - -NNTPArticleInfo::NNTPArticleInfo() -{ - init(); -} - -NNTPArticleInfo::NNTPArticleInfo(NNTPArticleInfo * other) -{ - init(); - mIndex = other->mIndex; - mSize = other->mSize; - MC_SAFE_REPLACE_COPY(String, mUid, other->mUid); -} - -NNTPArticleInfo::~NNTPArticleInfo() -{ - MC_SAFE_RELEASE(mUid); -} - -String * NNTPArticleInfo::description() -{ - return String::stringWithUTF8Format("<%s:%p %u %s %u>", - MCUTF8(className()), this, mIndex, MCUTF8(mUid), mSize); -} - -Object * NNTPArticleInfo::copy() -{ - return new NNTPArticleInfo(this); -} - -void NNTPArticleInfo::setIndex(unsigned int index) -{ - mIndex = index; -} - -unsigned int NNTPArticleInfo::index() -{ - return mIndex; -} - -void NNTPArticleInfo::setSize(unsigned int size) -{ - mSize = size; -} - -unsigned int NNTPArticleInfo::size() -{ - return mSize; -} - -void NNTPArticleInfo::setUid(String * uid) -{ - MC_SAFE_REPLACE_COPY(String, mUid, uid); -} - -String * NNTPArticleInfo::uid() -{ - return mUid; -} diff --git a/src/core/nntp/MCNNTPArticleInfo.h b/src/core/nntp/MCNNTPArticleInfo.h deleted file mode 100644 index 7fa90e19..00000000 --- a/src/core/nntp/MCNNTPArticleInfo.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef MAILCORE_MCNNTPARTICLEINFO_H - -#define MAILCORE_MCNNTPARTICLEINFO_H - -#include <MailCore/MCBaseTypes.h> - -#ifdef __cplusplus - -namespace mailcore { - - class NNTPArticleInfo : public Object { - public: - NNTPArticleInfo(); - virtual ~NNTPArticleInfo(); - - virtual void setIndex(unsigned int index); - virtual unsigned int index(); - - virtual void setSize(unsigned int size); - virtual unsigned int size(); - - virtual void setUid(String * uid); - virtual String * uid(); - - public: // subclass behavior - NNTPArticleInfo(NNTPArticleInfo * other); - virtual String * description(); - virtual Object * copy(); - - private: - unsigned int mIndex; - unsigned int mSize; - String * mUid; - - void init(); - }; - -} - -#endif - -#endif diff --git a/src/core/nntp/MCNNTPSession.cc b/src/core/nntp/MCNNTPSession.cc index d8cf2632..02db197e 100644 --- a/src/core/nntp/MCNNTPSession.cc +++ b/src/core/nntp/MCNNTPSession.cc @@ -11,7 +11,6 @@ #include <string.h> #include <libetpan/libetpan.h> -#include "MCNNTPArticleInfo.h" #include "MCNNTPGroupInfo.h" #include "MCMessageHeader.h" #include "MCConnectionLoggerUtils.h" @@ -431,11 +430,6 @@ MessageHeader * NNTPSession::fetchHeader(String *groupName, unsigned int index, return result; } -MessageHeader * NNTPSession::fetchHeader(String *groupName, NNTPArticleInfo * msg, ErrorCode * pError) -{ - return fetchHeader(groupName, msg->index(), pError); -} - Data * NNTPSession::fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError) { int r; @@ -472,12 +466,7 @@ Data * NNTPSession::fetchArticle(String *groupName, unsigned int index, NNTPProg return result; } -Data * NNTPSession::fetchArticle(String *groupName, NNTPArticleInfo * msg, NNTPProgressCallback * callback, ErrorCode * pError) -{ - return fetchArticle(groupName, msg->index(), callback, pError); -} - -Array * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) +IndexSet * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) { int r; clist * msg_list; @@ -497,7 +486,7 @@ Array * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) return NULL; } - Array * result = Array::array(); + IndexSet * result = new IndexSet(); clistiter * iter; for(iter = clist_begin(msg_list) ;iter != NULL ; iter = clist_next(iter)) { uint32_t *msg_info; @@ -507,10 +496,7 @@ Array * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) continue; } - NNTPArticleInfo * info = new NNTPArticleInfo(); - info->setIndex(*msg_info); - result->addObject(info); - info->release(); + result->addIndex(*msg_info); } newsnntp_listgroup_free(msg_list); diff --git a/src/core/nntp/MCNNTPSession.h b/src/core/nntp/MCNNTPSession.h index bdeb3bc1..a6fb511c 100644 --- a/src/core/nntp/MCNNTPSession.h +++ b/src/core/nntp/MCNNTPSession.h @@ -8,7 +8,6 @@ namespace mailcore { - class NNTPArticleInfo; class NNTPProgressCallback; class MessageHeader; @@ -49,12 +48,10 @@ namespace mailcore { virtual Array * listSubscribedNewsgroups(ErrorCode * pError); virtual MessageHeader * fetchHeader(String *groupName, unsigned int index, ErrorCode * pError); - virtual MessageHeader * fetchHeader(String *groupName, NNTPArticleInfo * msg, ErrorCode * pError); - - virtual Array * /* NNTPArticleInfo */ fetchArticles(String * groupname, ErrorCode * pError); + + virtual IndexSet * fetchArticles(String * groupname, ErrorCode * pError); Data * fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError); - Data * fetchArticle(String *groupName, NNTPArticleInfo * msg, NNTPProgressCallback * callback, ErrorCode * pError); virtual void setConnectionLogger(ConnectionLogger * logger); virtual ConnectionLogger * connectionLogger(); |