allow quote / reply date & time format to be set using %D{format}.
[claws.git] / src / imap.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 Hiroyuki Yamamoto
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __IMAP_H__
21 #define __IMAP_H__
22
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26
27 #include <glib.h>
28 #include <time.h>
29
30 #include "folder.h"
31 #include "session.h"
32 #include "procmsg.h"
33
34 typedef struct _IMAPFolder      IMAPFolder;
35 typedef struct _IMAPSession     IMAPSession;
36 typedef struct _IMAPNameSpace   IMAPNameSpace;
37
38 #include "prefs_account.h"
39
40 #define IMAP_FOLDER(obj)        ((IMAPFolder *)obj)
41 #define IMAP_SESSION(obj)       ((IMAPSession *)obj)
42
43 struct _IMAPFolder
44 {
45         RemoteFolder rfolder;
46
47         /* list of IMAPNameSpace */
48         GList *ns_personal;
49         GList *ns_others;
50         GList *ns_shared;
51 };
52
53 struct _IMAPSession
54 {
55         Session session;
56
57         gchar *mbox;
58         time_t last_access_time;
59 };
60
61 struct _IMAPNameSpace
62 {
63         gchar *name;
64         gchar separator;
65 };
66
67 #define IMAP_SUCCESS    0
68 #define IMAP_SOCKET     2
69 #define IMAP_AUTHFAIL   3
70 #define IMAP_PROTOCOL   4
71 #define IMAP_SYNTAX     5
72 #define IMAP_IOERR      6
73 #define IMAP_ERROR      7
74
75 #define IMAPBUFSIZE     8192
76
77 typedef enum
78 {
79         IMAP_FLAG_SEEN          = 1 << 0,
80         IMAP_FLAG_ANSWERED      = 1 << 1,
81         IMAP_FLAG_FLAGGED       = 1 << 2,
82         IMAP_FLAG_DELETED       = 1 << 3,
83         IMAP_FLAG_DRAFT         = 1 << 4
84 } IMAPFlags;
85
86 #define IMAP_IS_SEEN(flags)     ((flags & IMAP_FLAG_SEEN) != 0)
87 #define IMAP_IS_ANSWERED(flags) ((flags & IMAP_FLAG_ANSWERED) != 0)
88 #define IMAP_IS_FLAGGED(flags)  ((flags & IMAP_FLAG_FLAGGED) != 0)
89 #define IMAP_IS_DELETED(flags)  ((flags & IMAP_FLAG_DELETED) != 0)
90 #define IMAP_IS_DRAFT(flags)    ((flags & IMAP_FLAG_DRAFT) != 0)
91
92 Folder  *imap_folder_new                (const gchar    *name,
93                                          const gchar    *path);
94 void     imap_folder_destroy            (IMAPFolder     *folder);
95
96 Session *imap_session_new               (const PrefsAccount *account);
97 void imap_session_destroy               (IMAPSession    *session);
98 void imap_session_destroy_all           (void);
99
100 GSList *imap_get_msg_list               (Folder         *folder,
101                                          FolderItem     *item,
102                                          gboolean        use_cache);
103 gchar *imap_fetch_msg                   (Folder         *folder,
104                                          FolderItem     *item,
105                                          gint            uid);
106 gint imap_add_msg                       (Folder         *folder,
107                                          FolderItem     *dest,
108                                          const gchar    *file,
109                                          gboolean        remove_source);
110
111 gint imap_move_msg                      (Folder         *folder,
112                                          FolderItem     *dest,
113                                          MsgInfo        *msginfo);
114 gint imap_move_msgs_with_dest           (Folder         *folder,
115                                          FolderItem     *dest,
116                                          GSList         *msglist);
117 gint imap_copy_msg                      (Folder         *folder,
118                                          FolderItem     *dest,
119                                          MsgInfo        *msginfo);
120 gint imap_copy_msgs_with_dest           (Folder         *folder,
121                                          FolderItem     *dest,
122                                          GSList         *msglist);
123
124 gint imap_remove_msg                    (Folder         *folder,
125                                          FolderItem     *item,
126                                          gint            uid);
127 gint imap_remove_all_msg                (Folder         *folder,
128                                          FolderItem     *item);
129 gboolean imap_is_msg_changed            (Folder         *folder,
130                                          FolderItem     *item,
131                                          MsgInfo        *msginfo);
132
133 gint imap_scan_folder                   (Folder         *folder,
134                                          FolderItem     *item);
135 void imap_scan_tree                     (Folder         *folder);
136
137 gint imap_create_tree                   (Folder         *folder);
138
139 FolderItem *imap_create_folder          (Folder         *folder,
140                                          FolderItem     *parent,
141                                          const gchar    *name);
142 gint imap_rename_folder                 (Folder         *folder,
143                                          FolderItem     *item,
144                                          const gchar    *name);
145 gint imap_remove_folder                 (Folder         *folder,
146                                          FolderItem     *item);
147
148 gint imap_msg_set_perm_flags            (MsgInfo        *msginfo,
149                                          MsgPermFlags    flags);
150 gint imap_msg_unset_perm_flags          (MsgInfo        *msginfo,
151                                          MsgPermFlags    flags);
152
153 #endif /* __IMAP_H__ */