aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async/pop/MCPOPFetchMessageOperation.cpp
blob: ca822a9efb3e547f52996b75aeae441eed5c010b (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
//
//  MCPOPFetchMessageOperation.cc
//  mailcore2
//
//  Created by DINH Viêt Hoà on 1/16/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#include "MCPOPFetchMessageOperation.h"

#include "MCPOPAsyncSession.h"
#include "MCPOPSession.h"

using namespace mailcore;

POPFetchMessageOperation::POPFetchMessageOperation()
{
    mMessageIndex = 0;
    mData = NULL;
}

POPFetchMessageOperation::~POPFetchMessageOperation()
{
    MC_SAFE_RELEASE(mData);
}

void POPFetchMessageOperation::setMessageIndex(unsigned int messageIndex)
{
    mMessageIndex = messageIndex;
}

unsigned int POPFetchMessageOperation::messageIndex()
{
    return mMessageIndex;
}

Data * POPFetchMessageOperation::data()
{
    return mData;
}

void POPFetchMessageOperation::main()
{
    ErrorCode error;
    mData = session()->session()->fetchMessage(mMessageIndex, this, &error);
    MC_SAFE_RETAIN(mData);
    setError(error);
}