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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
//
// MCOPOPSession.m
// mailcore2
//
// Created by DINH Viêt Hoà on 3/29/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#import "MCOPOPSession.h"
#include "MCAsyncPOP.h"
#import "MCOUtils.h"
#import "MCOPOPOperation.h"
#import "MCOOperation+Private.h"
#import "MCOPOPFetchMessagesOperation.h"
@implementation MCOPOPSession {
mailcore::POPAsyncSession * _session;
}
#define nativeType mailcore::POPAsyncSession
- (mailcore::Object *) mco_mcObject
{
return _session;
}
- (NSString *) description
{
return MCO_OBJC_BRIDGE_GET(description);
}
- (id)init {
self = [super init];
if (self) {
_session = new mailcore::POPAsyncSession();
}
return self;
}
- (void)dealloc {
_session->release();
[super dealloc];
}
MCO_OBJC_SYNTHESIZE_STRING(setHostname, hostname)
MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setPort, port)
MCO_OBJC_SYNTHESIZE_STRING(setUsername, username)
MCO_OBJC_SYNTHESIZE_STRING(setPassword, password)
MCO_OBJC_SYNTHESIZE_SCALAR(MCOAuthType, mailcore::AuthType, setAuthType, authType)
MCO_OBJC_SYNTHESIZE_SCALAR(MCOConnectionType, mailcore::ConnectionType, setConnectionType, connectionType)
MCO_OBJC_SYNTHESIZE_SCALAR(NSTimeInterval, time_t, setTimeout, timeout)
MCO_OBJC_SYNTHESIZE_BOOL(setCheckCertificateEnabled, isCheckCertificateEnabled)
#pragma mark - Operations
- (MCOPOPFetchMessagesOperation *) fetchMessagesOperation
{
mailcore::POPFetchMessagesOperation * coreOp = MCO_NATIVE_INSTANCE->fetchMessagesOperation();
return MCO_TO_OBJC(coreOp);
}
- (MCOPOPFetchHeaderOperation *) fetchHeaderOperationWithIndex:(unsigned int)index
{
mailcore::POPFetchHeaderOperation * coreOp = MCO_NATIVE_INSTANCE->fetchHeaderOperation(index);
return MCO_TO_OBJC(coreOp);
}
- (MCOPOPFetchMessageOperation *) fetchMessageOperationWithIndex:(unsigned int)index;
{
mailcore::POPFetchMessageOperation * coreOp = MCO_NATIVE_INSTANCE->fetchMessageOperation(index);
return MCO_TO_OBJC(coreOp);
}
// Will disconnect.
- (MCOPOPOperation *) deleteMessagesWithIndexes:(MCOIndexSet *)indexes
{
mailcore::POPOperation * coreOp = MCO_NATIVE_INSTANCE->deleteMessagesOperation(MCO_FROM_OBJC(mailcore::IndexSet, indexes));
return [[[MCOPOPOperation alloc] initWithMCOperation:coreOp] autorelease];
}
@end
|