aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async/imap/MCIMAPCustomCommandOperation.cpp
blob: 3995d6aa4ce9102ed8ff465dcda80fe6413067ba (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
//
//  MCIMAPCustomCommandOperation.cpp
//  mailcore2
//
//  Created by Libor Huspenina on 18/10/2015.
//  Copyright © 2015 MailCore. All rights reserved.
//

#include "MCIMAPCustomCommandOperation.h"

#include "MCIMAPSession.h"
#include "MCIMAPAsyncConnection.h"

using namespace mailcore;

IMAPCustomCommandOperation::IMAPCustomCommandOperation()
{
    mCustomCommand = NULL;
    mResponse = NULL;
}

IMAPCustomCommandOperation::~IMAPCustomCommandOperation()
{
    MC_SAFE_RELEASE(mCustomCommand);
    MC_SAFE_RELEASE(mResponse);
}

void IMAPCustomCommandOperation::setCustomCommand(String * command)
{
    MC_SAFE_REPLACE_COPY(String, mCustomCommand, command);
}

String * IMAPCustomCommandOperation::response()
{
    return mResponse;
}

void IMAPCustomCommandOperation::main()
{
    ErrorCode error;
    mResponse = session()->session()->customCommand(mCustomCommand, &error);
    MC_SAFE_RETAIN(mResponse);
    setError(error);
}