2
* Copyright (C) 2005 Novell Inc.
5
* Michael Zucchi <notzed@ximian.com>
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of version 2 of the GNU General Public
9
* License as published by the Free Software Foundation.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
16
* You should have received a copy of the GNU General Public
17
* License along with this program; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
22
#ifndef _CAMEL_IMAPX_SERVER_H
23
#define _CAMEL_IMAPX_SERVER_H
25
#include <camel/camel-msgport.h>
26
#include <camel/camel-list-utils.h>
27
#include <libedataserver/e-flag.h>
30
struct _CamelException;
31
struct _CamelMimeMessage;
32
struct _CamelMessageInfo;
34
#define CAMEL_IMAPX_SERVER(obj) CAMEL_CHECK_CAST (obj, camel_imapx_server_get_type (), CamelIMAPPServer)
35
#define CAMEL_IMAPX_SERVER_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_imapx_server_get_type (), CamelIMAPPServerClass)
36
#define CAMEL_IS_IMAPX_SERVER(obj) CAMEL_CHECK_TYPE (obj, camel_imapx_server_get_type ())
38
typedef struct _CamelIMAPXServer CamelIMAPXServer;
39
typedef struct _CamelIMAPXServerClass CamelIMAPXServerClass;
41
#define IMAPX_MODE_READ (1<<0)
42
#define IMAPX_MODE_WRITE (1<<1)
44
struct _CamelIMAPXServer {
47
struct _CamelStore *store;
48
struct _CamelSession *session;
50
/* Info about the current connection */
51
struct _CamelURL *url;
52
struct _CamelIMAPXStream *stream;
53
struct _capability_info *cinfo;
54
gboolean is_ssl_stream;
56
CamelIMAPXNamespaceList *nsl;
61
/* in micro seconds */
67
/* Current command/work queue. All commands are stored in one list,
68
all the time, so they can be cleaned up in exception cases */
69
GStaticRecMutex queue_lock;
70
struct _CamelIMAPXCommand *literal;
75
/* info on currently selected folder */
76
struct _CamelFolder *select_folder;
78
struct _CamelFolderChangeInfo *changes;
79
struct _CamelFolder *select_pending;
80
guint32 permanentflags;
88
/* any expunges that happened from the last command, they are
89
processed after the command completes. */
92
GThread *parser_thread;
93
/* Protects the output stream between parser thread (which can disconnect from server) and other threads that issue
94
commands. Input stream does not require a lock since only parser_thread can operate on it */
95
GStaticRecMutex ostream_lock;
96
/* Used for canceling operations as well as signaling parser thread to disconnnect/quit */
101
struct _CamelIMAPXIdle *idle;
104
/* used for storing eflags to syncronize duplicate get_message requests */
105
GHashTable *uid_eflags;
108
struct _CamelIMAPXServerClass {
109
CamelObjectClass cclass;
114
CamelType camel_imapx_server_get_type (void);
115
CamelIMAPXServer *camel_imapx_server_new(struct _CamelStore *store, struct _CamelURL *url);
117
gboolean camel_imapx_server_connect(CamelIMAPXServer *is, gint state, CamelException *ex);
118
gboolean imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex);
120
GPtrArray *camel_imapx_server_list(CamelIMAPXServer *is, const gchar *top, guint32 flags, CamelException *ex);
122
void camel_imapx_server_refresh_info(CamelIMAPXServer *is, CamelFolder *folder, struct _CamelException *ex);
123
void camel_imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
124
void camel_imapx_server_expunge(CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
125
void camel_imapx_server_noop (CamelIMAPXServer *is, CamelFolder *folder, CamelException *ex);
127
CamelStream *camel_imapx_server_get_message(CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, struct _CamelException *ex);
128
void camel_imapx_server_copy_message (CamelIMAPXServer *is, CamelFolder *source, CamelFolder *dest, GPtrArray *uids, gboolean delete_originals, CamelException *ex);
129
void camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, struct _CamelMimeMessage *message, const struct _CamelMessageInfo *mi, CamelException *ex);
130
void camel_imapx_server_sync_message (CamelIMAPXServer *is, CamelFolder *folder, const gchar *uid, CamelException *ex);
132
void camel_imapx_server_manage_subscription (CamelIMAPXServer *is, const gchar *folder_name, gboolean subscribe, CamelException *ex);
133
void camel_imapx_server_create_folder (CamelIMAPXServer *is, const gchar *folder_name, CamelException *ex);
134
void camel_imapx_server_delete_folder (CamelIMAPXServer *is, const gchar *folder_name, CamelException *ex);
135
void camel_imapx_server_rename_folder (CamelIMAPXServer *is, const gchar *old_name, const gchar *new_name, CamelException *ex);
137
#endif /* _CAMEL_IMAPX_SERVER_H */