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

#include "MCIMAPCheckAccountOperation.h"

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

using namespace mailcore;

IMAPCheckAccountOperation::IMAPCheckAccountOperation()
{
    mLoginResponse = NULL;
}

IMAPCheckAccountOperation::~IMAPCheckAccountOperation()
{
    MC_SAFE_RELEASE(mLoginResponse);
}

void IMAPCheckAccountOperation::main()
{
    ErrorCode error;
    session()->session()->connectIfNeeded(&error);
    if (error == ErrorNone) {
        session()->session()->login(&error);
        if (error != ErrorNone) {
            MC_SAFE_REPLACE_COPY(String, mLoginResponse, session()->session()->loginResponse());
        }
    }
    setError(error);
}

String * IMAPCheckAccountOperation::loginResponse()
{
    return mLoginResponse;
}