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

#include "MCPOPFetchHeaderOperation.h"

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

using namespace mailcore;

POPFetchHeaderOperation::POPFetchHeaderOperation()
{
    mMessageIndex = 0;
    mHeader = NULL;
}

POPFetchHeaderOperation::~POPFetchHeaderOperation()
{
    MC_SAFE_RELEASE(mHeader);
}

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

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

MessageHeader * POPFetchHeaderOperation::header()
{
    return mHeader;
}

void POPFetchHeaderOperation::main()
{
    ErrorCode error;
    mHeader = session()->session()->fetchHeader(mMessageIndex, &error);
    if (mHeader != NULL) {
        mHeader->retain();
    }
    setError(error);
}