blob: 5f4d1f5964ad5c05a6b350e9d65c2c8343e79238 (
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
52
53
54
55
56
57
58
59
|
//
// MCODeleteMessagesOperation.m
// mailcore2
//
// Created by DINH Viêt Hoà on 3/29/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#import "MCOPOPOperation.h"
#include "MCAsyncPOP.h"
#import "MCOUtils.h"
#import "MCOOperation+Private.h"
#import "MCOPOPSession.h"
typedef void (^CompletionType)(NSError *error);
@implementation MCOPOPOperation {
CompletionType _completionBlock;
MCOPOPSession * _session;
}
#define nativeType mailcore::POPOperation
- (void) dealloc
{
[_session release];
[_completionBlock release];
[super dealloc];
}
- (void)start:(void (^)(NSError *error))completionBlock {
_completionBlock = [completionBlock copy];
[self start];
}
- (void)operationCompleted {
if (_completionBlock == NULL)
return;
NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()];
_completionBlock(error);
[_completionBlock release];
_completionBlock = nil;
}
- (void) setSession:(MCOPOPSession *)session
{
[_session release];
_session = [session retain];
}
- (MCOPOPSession *) session
{
return _session;
}
@end
|