aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async/nntp/MCNNTPSendOperation.cpp
blob: d5f27928b8105526f1841f7682ee52c00820612b (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
50
51
52
53
54
55
56
57
58
//
//  MCNNTPSendOperation.cpp
//  mailcore2
//
//  Created by Daryle Walker on 2/21/16.
//  Copyright © 2016 MailCore. All rights reserved.
//

#include "MCNNTPSendOperation.h"

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

using namespace mailcore;

NNTPSendOperation::NNTPSendOperation()
{
    mMessageData = NULL;
    mMessageFilepath = NULL;
}

NNTPSendOperation::~NNTPSendOperation()
{
    MC_SAFE_RELEASE(mMessageFilepath);
    MC_SAFE_RELEASE(mMessageData);
}

void NNTPSendOperation::setMessageData(Data * data)
{
    MC_SAFE_REPLACE_RETAIN(Data, mMessageData, data);
}

Data * NNTPSendOperation::messageData()
{
    return mMessageData;
}

void NNTPSendOperation::setMessageFilepath(String * path)
{
    MC_SAFE_REPLACE_RETAIN(String, mMessageFilepath, path);
}

String * NNTPSendOperation::messageFilepath()
{
    return mMessageFilepath;
}

void NNTPSendOperation::main()
{
    ErrorCode error;
    if (mMessageFilepath != NULL) {
        session()->session()->sendMessage(mMessageFilepath, this, &error);
    }
    else {
        session()->session()->sendMessage(mMessageData, this, &error);
    }
    setError(error);
}