2007-12-06 [colin] 3.1.0cvs63
[claws.git] / src / etpan / imap-thread.h
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2005-2007 DINH Viet Hoa and the Claws Mail team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  * 
18  */
19
20 #ifndef IMAP_THREAD_H
21
22 #define IMAP_THREAD_H
23
24 #include <libetpan/libetpan.h>
25 #include "folder.h"
26
27 #define IMAP_SET_MAX_COUNT 500
28
29 void imap_main_set_timeout(int sec);
30 void imap_main_init(gboolean skip_ssl_cert_check);
31 void imap_main_done(void);
32
33 void imap_init(Folder * folder);
34 void imap_done(Folder * folder);
35
36 int imap_threaded_connect(Folder * folder, const char * server, int port);
37 int imap_threaded_connect_ssl(Folder * folder, const char * server, int port);
38 struct mailimap_capability_data * imap_threaded_capability(Folder *folder, int *ok);
39
40 #ifndef G_OS_WIN32
41 int imap_threaded_connect_cmd(Folder * folder, const char * command,
42                               const char * server, int port);
43 #endif
44 void imap_threaded_disconnect(Folder * folder);
45
46 int imap_threaded_list(Folder * folder, const char * base,
47                        const char * wildcard,
48                        clist ** p_result);
49 int imap_threaded_lsub(Folder * folder, const char * base,
50                        const char * wildcard,
51                        clist ** p_result);
52 int imap_threaded_login(Folder * folder,
53                         const char * login, const char * password,
54                         const char * type);
55 int imap_threaded_status(Folder * folder, const char * mb,
56                 struct mailimap_mailbox_data_status ** data_status,
57                 guint mask);
58 int imap_threaded_close(Folder * folder);
59
60 int imap_threaded_noop(Folder * folder, unsigned int * p_exists, 
61                        unsigned int *p_recent, 
62                        unsigned int *p_expunge,
63                        unsigned int *p_unseen,
64                        unsigned int *p_uidnext,
65                        unsigned int *p_uidval);
66 int imap_threaded_starttls(Folder * folder, const gchar *host, int port);
67 int imap_threaded_create(Folder * folder, const char * mb);
68 int imap_threaded_rename(Folder * folder,
69                          const char * mb, const char * new_name);
70 int imap_threaded_delete(Folder * folder, const char * mb);
71 int imap_threaded_select(Folder * folder, const char * mb,
72                          gint * exists, gint * recent, gint * unseen,
73                          guint32 * uid_validity, gint * can_create_flags);
74 int imap_threaded_examine(Folder * folder, const char * mb,
75                           gint * exists, gint * recent, gint * unseen,
76                           guint32 * uid_validity);
77 int imap_threaded_subscribe(Folder * folder, const char * mb,
78                        gboolean subscribe);
79
80 enum {
81         IMAP_SEARCH_TYPE_SIMPLE,
82         IMAP_SEARCH_TYPE_SEEN,
83         IMAP_SEARCH_TYPE_UNSEEN,
84         IMAP_SEARCH_TYPE_ANSWERED,
85         IMAP_SEARCH_TYPE_FLAGGED,
86         IMAP_SEARCH_TYPE_DELETED,
87 };
88
89 int imap_threaded_search(Folder * folder, int search_type,
90                          struct mailimap_set * set, clist ** result);
91
92 int imap_threaded_fetch_uid(Folder * folder, uint32_t first_index,
93                             carray ** result);
94
95 void imap_fetch_uid_list_free(carray * uid_list);
96
97 int imap_threaded_fetch_uid_flags(Folder * folder, uint32_t first_index,
98                                   carray ** fetch_result);
99
100 void imap_fetch_uid_flags_list_free(carray * uid_flags_list);
101
102 int imap_threaded_fetch_content(Folder * folder, uint32_t msg_index,
103                                 int with_body,
104                                 const char * filename);
105
106 struct imap_fetch_env_info {
107         uint32_t uid;
108         char * headers;
109         uint32_t size;
110         int flags;
111 };
112
113 int imap_threaded_fetch_env(Folder * folder, struct mailimap_set * set,
114                             carray ** p_env_list);
115
116 void imap_fetch_env_free(carray * env_list);
117
118 int imap_threaded_append(Folder * folder, const char * mailbox,
119                          const char * filename,
120                          struct mailimap_flag_list * flag_list,
121                          int *uid);
122
123 int imap_threaded_expunge(Folder * folder);
124
125 int imap_threaded_copy(Folder * folder, struct mailimap_set * set,
126                        const char * mb, struct mailimap_set **source,
127                        struct mailimap_set **dest);
128
129 int imap_threaded_store(Folder * folder, struct mailimap_set * set,
130                         struct mailimap_store_att_flags * store_att_flags);
131
132 void imap_threaded_cancel(Folder * folder);
133
134 #endif