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

#include "MCIMAPSubscribeFolderOperation.h"

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

using namespace mailcore;

IMAPSubscribeFolderOperation::IMAPSubscribeFolderOperation()
{
    mUnsubscribeEnabled = false;
}

IMAPSubscribeFolderOperation::~IMAPSubscribeFolderOperation()
{
}

void IMAPSubscribeFolderOperation::setUnsubscribeEnabled(bool enabled)
{
    mUnsubscribeEnabled = enabled;
}

bool IMAPSubscribeFolderOperation::isUnsubscribeEnabled()
{
    return mUnsubscribeEnabled;
}

void IMAPSubscribeFolderOperation::main()
{
    ErrorCode error;
    if (mUnsubscribeEnabled) {
        session()->session()->unsubscribeFolder(folder(), &error);
    }
    else {
        session()->session()->subscribeFolder(folder(), &error);
    }
    setError(error);
}