aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async/nntp/MCNNTPFetchAllArticlesOperation.cpp
blob: 044e9e5e03ad3cecb6c82c4bba994b579dc51c29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
//  MCNNTPFetchAllArticlesOperation.cpp
//  mailcore2
//
//  Created by Robert Widmann on 8/13/14.
//  Copyright (c) 2014 MailCore. All rights reserved.
//

#include "MCNNTPFetchAllArticlesOperation.h"

#include "MCNNTPAsyncSession.h"
#include "MCNNTPSession.h"

using namespace mailcore;

NNTPFetchAllArticlesOperation::NNTPFetchAllArticlesOperation()
{
    mGroupName = NULL;
    mArticles = NULL;
}

NNTPFetchAllArticlesOperation::~NNTPFetchAllArticlesOperation()
{
    MC_SAFE_RELEASE(mGroupName);
    MC_SAFE_RELEASE(mArticles);
}

void NNTPFetchAllArticlesOperation::setGroupName(String * groupname)
{
    MC_SAFE_REPLACE_COPY(String, mGroupName, groupname);
}

String * NNTPFetchAllArticlesOperation::groupName()
{
    return mGroupName;
}

IndexSet * NNTPFetchAllArticlesOperation::articles()
{
    return mArticles;
}

void NNTPFetchAllArticlesOperation::main()
{
    ErrorCode error;
    mArticles = session()->session()->fetchAllArticles(mGroupName, &error);
    setError(error);
    MC_SAFE_RETAIN(mArticles);
}