Repository navigation
Expand file tree
/
Copy pathMCIMAPOperation.h
More file actions
88 lines (65 loc) · 2.98 KB
/
Copy pathMCIMAPOperation.h
File metadata and controls
88 lines (65 loc) · 2.98 KB
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
84
85
86
87
88
//
// MCIMAPOperation.h
// mailcore2
//
// Created by DINH Viêt Hoà on 1/12/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#ifndef MAILCORE_MCIMAPOPERATION_H
#define MAILCORE_MCIMAPOPERATION_H
#include <MailCore/MCBaseTypes.h>
#include <MailCore/MCIMAPProgressCallback.h>
#ifdef __cplusplus
namespace mailcore {
class IMAPAsyncConnection;
class IMAPAsyncSession;
class IMAPOperationCallback;
class MAILCORE_EXPORT IMAPOperation : public Operation, public IMAPProgressCallback {
public:
IMAPOperation();
virtual ~IMAPOperation();
virtual void setMainSession(IMAPAsyncSession * session);
virtual IMAPAsyncSession * mainSession();
virtual void setSession(IMAPAsyncConnection * session);
virtual IMAPAsyncConnection * session();
virtual void setFolder(String * folder);
virtual String * folder();
virtual void setUrgent(bool urgent);
virtual bool isUrgent();
virtual void setImapCallback(IMAPOperationCallback * callback);
virtual IMAPOperationCallback * imapCallback();
virtual void beforeMain();
virtual void afterMain();
virtual void interrupt();
/** Aborts this operation's IMAP command if it is the one currently running on its
connection: the blocked read returns at once instead of waiting out the socket timeout, so
the operations queued behind it (a disconnect, most importantly) run immediately.
Does nothing when the operation is not the one running.
Teardown of this connection only - a command in flight fails with a connection error, a
cut that met none fails nothing, and either way the connection is rebuilt before the next
operation's first command - so call it for a command that is being abandoned (cancelled,
or given up on), never to hurry up a command whose result still matters.
Returns whether this operation was the one the queue was running at that moment. That may
include a command that finished just as the interrupt landed: its result is intact, but
the stream is cancelled all the same. */
virtual bool interruptCurrentCommand();
virtual void start();
// Result.
virtual void setError(ErrorCode error);
virtual ErrorCode error();
private:
IMAPAsyncSession * mMainSession;
IMAPAsyncConnection * mSession;
String * mFolder;
IMAPOperationCallback * mImapCallback;
ErrorCode mError;
bool mUrgent;
private:
virtual void bodyProgress(IMAPSession * session, unsigned int current, unsigned int maximum);
virtual void bodyProgressOnMainThread(void * context);
virtual void itemsProgress(IMAPSession * session, unsigned int current, unsigned int maximum);
virtual void itemsProgressOnMainThread(void * context);
};
}
#endif
#endif