aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/imap/MCOIMAPOperation.mm
blob: a928fede64d384c56fe917d94855c5d7f7648ac1 (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
//
//  MCOIMAPOperation.m
//  mailcore2
//
//  Created by DINH Viêt Hoà on 3/23/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#import "MCOIMAPOperation.h"

#include "MCIMAPOperation.h"
#import "MCOOperation+Private.h"

#import "MCOUtils.h"

typedef void (^completionType)(NSError *error);

@implementation MCOIMAPOperation {
    completionType _completionBlock;
}

#define nativeType mailcore::IMAPOperation

- (void) dealloc
{
    [_completionBlock release];
    [super dealloc];
}

- (void)start:(void (^)(NSError *error))completionBlock {
    _completionBlock = [completionBlock copy];
    [self start];
}

- (void)operationCompleted {
    NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()];
    _completionBlock(error);
}

@end