f226fa45e7a5a67f05dca164d6f067c8d2e7c890
[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 2 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, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 100
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 int imap_threaded_connect_cmd(Folder * folder, const char * command,
40                               const char * server, int port);
41
42 void imap_threaded_disconnect(Folder * folder);
43
44 int imap_threaded_list(Folder * folder, const char * base,
45                        const char * wildcard,
46                        clist ** p_result);
47 int imap_threaded_lsub(Folder * folder, const char * base,
48                        const char * wildcard,
49                        clist ** p_result);
50 int imap_threaded_login(Folder * folder,
51                         const char * login, const char * password,
52                         const char * type);
53 int imap_threaded_status(Folder * folder, const char * mb,
54                 struct mailimap_mailbox_data_status ** data_status,
55                 guint mask);
56
57 int imap_threaded_noop(Folder * folder, unsigned int * p_exists);
58 int imap_threaded_starttls(Folder * folder, const gchar *host, int port);
59 int imap_threaded_create(Folder * folder, const char * mb);
60 int imap_threaded_rename(Folder * folder,
61                          const char * mb, const char * new_name);
62 int imap_threaded_delete(Folder * folder, const char * mb);
63 int imap_threaded_select(Folder * folder, const char * mb,
64                          gint * exists, gint * recent, gint * unseen,
65                          guint32 * uid_validity);
66 int imap_threaded_examine(Folder * folder, const char * mb,
67                           gint * exists, gint * recent, gint * unseen,
68                           guint32 * uid_validity);
69 int imap_threaded_subscribe(Folder * folder, const char * mb,
70                        gboolean subscribe);
71
72 enum {
73         IMAP_SEARCH_TYPE_SIMPLE,
74         IMAP_SEARCH_TYPE_SEEN,
75         IMAP_SEARCH_TYPE_UNSEEN,
76         IMAP_SEARCH_TYPE_ANSWERED,
77         IMAP_SEARCH_TYPE_FLAGGED,
78         IMAP_SEARCH_TYPE_DELETED,
79 };
80
81 int imap_threaded_search(Folder * folder, int search_type,
82                          struct mailimap_set * set, clist ** result);
83
84 int imap_threaded_fetch_uid(Folder * folder, uint32_t first_index,
85                             carray ** result);
86
87 void imap_fetch_uid_list_free(carray * uid_list);
88
89 int imap_threaded_fetch_content(Folder * folder, uint32_t msg_index,
90                                 int with_body,
91                                 const char * filename);
92
93 struct imap_fetch_env_info {
94         uint32_t uid;
95         char * headers;
96         uint32_t size;
97         int flags;
98 };
99
100 int imap_threaded_fetch_env(Folder * folder, struct mailimap_set * set,
101                             carray ** p_env_list);
102
103 void imap_fetch_env_free(carray * env_list);
104
105 int imap_threaded_append(Folder * folder, const char * mailbox,
106                          const char * filename,
107                          struct mailimap_flag_list * flag_list,
108                          int *uid);
109
110 int imap_threaded_expunge(Folder * folder);
111
112 int imap_threaded_copy(Folder * folder, struct mailimap_set * set,
113                        const char * mb, struct mailimap_set **source,
114                        struct mailimap_set **dest);
115
116 int imap_threaded_store(Folder * folder, struct mailimap_set * set,
117                         struct mailimap_store_att_flags * store_att_flags);
118
119 #endif