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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/*
* Copyright (C) 2005 Novell Inc.
*
* Authors:
* Michael Zucchi <notzed@ximian.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _CAMEL_IMAPX_SERVER_H
#define _CAMEL_IMAPX_SERVER_H
#include <camel/camel-msgport.h>
#include <camel/camel-list-utils.h>
#include <libedataserver/e-flag.h>
struct _CamelFolder;
struct _CamelException;
struct _CamelMimeMessage;
struct _CamelMessageInfo;
#define CAMEL_IMAPX_SERVER(obj) CAMEL_CHECK_CAST (obj, camel_imapx_server_get_type (), CamelIMAPPServer)
#define CAMEL_IMAPX_SERVER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_imapx_server_get_type (), CamelIMAPPServerClass)
#define CAMEL_IS_IMAPX_SERVER(obj) CAMEL_CHECK_TYPE (obj, camel_imapx_server_get_type ())
typedef struct _CamelIMAPXServer CamelIMAPXServer;
typedef struct _CamelIMAPXServerClass CamelIMAPXServerClass;
#define IMAPX_MODE_READ (1<<0)
#define IMAPX_MODE_WRITE (1<<1)
struct _CamelIMAPXServer {
CamelObject cobject;
struct _CamelStore *store;
struct _CamelSession *session;
/* Info about the current connection */
struct _CamelURL *url;
struct _CamelIMAPXStream *stream;
struct _capability_info *cinfo;
gboolean is_process_stream;
CamelIMAPXNamespaceList *nsl;
/* incoming jobs */
CamelMsgPort *port;
CamelDList jobs;
/* in micro seconds */
guint job_timeout;
gchar tagprefix;
gint state:4;
/* Current command/work queue. All commands are stored in one list,
all the time, so they can be cleaned up in exception cases */
GStaticRecMutex queue_lock;
struct _CamelIMAPXCommand *literal;
CamelDList queue;
CamelDList active;
CamelDList done;
/* info on currently selected folder */
struct _CamelFolder *select_folder;
gchar *select;
struct _CamelFolderChangeInfo *changes;
struct _CamelFolder *select_pending;
guint32 permanentflags;
guint32 unseen;
guint64 uidvalidity;
guint64 highestmodseq;
guint32 uidnext;
guint32 exists;
guint32 recent;
guint32 mode;
/* any expunges that happened from the last command, they are
processed after the command completes. */
GSList *expunged;
GThread *parser_thread;
/* Protects the output stream between parser thread (which can disconnect from server) and other threads that issue
commands. Input stream does not require a lock since only parser_thread can operate on it */
GStaticRecMutex ostream_lock;
/* Used for canceling operations as well as signaling parser thread to disconnnect/quit */
CamelOperation *op;
gboolean parser_quit;
/* Idle */
struct _CamelIMAPXIdle *idle;
gboolean use_idle;
/* used for storing eflags to syncronize duplicate get_message requests */
GHashTable *uid_eflags;
};
struct _CamelIMAPXServerClass {
CamelObjectClass cclass;
gchar tagprefix;
};
CamelType camel_imapx_server_get_type (void);
CamelIMAPXServer *camel_imapx_server_new(struct _CamelStore *store, struct _CamelURL *url);
gboolean camel_imapx_server_connect(CamelIMAPXServer *is, gint state, CamelException *ex);
gboolean imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex);
GPtrArray *camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags, const gchar *ext, CamelException *ex);
void camel_imapx_server_refresh_info(CamelIMAPXServer *is, CamelFolder *folder, struct _CamelException *ex);
void camel_imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
void camel_imapx_server_expunge(CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
void camel_imapx_server_noop (CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
CamelStream *camel_imapx_server_get_message(CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, struct _CamelException *ex);
void camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source, CamelFolder *dest, GPtrArray *uids, gboolean delete_originals, CamelException *ex);
void camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, struct _CamelMimeMessage *message, const struct _CamelMessageInfo *mi, CamelException *ex);
void camel_imapx_server_sync_message (CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, CamelException *ex);
void camel_imapx_server_manage_subscription (CamelIMAPXServer *is, const gchar *folder_name, gboolean subscribe, CamelException *ex);
void camel_imapx_server_create_folder (CamelIMAPXServer *is, const gchar *folder_name, CamelException *ex);
void camel_imapx_server_delete_folder (CamelIMAPXServer *is, const gchar *folder_name, CamelException *ex);
void camel_imapx_server_rename_folder (CamelIMAPXServer *is, const gchar *old_name, const gchar *new_name, CamelException *ex);
#endif /* _CAMEL_IMAPX_SERVER_H */
|