0.8.11claws26
[claws.git] / src / prefs_account.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2003 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 __PREFS_ACCOUNT_H__
21 #define __PREFS_ACCOUNT_H__
22
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26
27 #include <glib.h>
28
29 typedef struct _PrefsAccount    PrefsAccount;
30
31 #include "folder.h"
32 #include "smtp.h"
33
34 #ifdef USE_GPGME
35 #  include "rfc2015.h"
36 #endif
37
38 typedef enum {
39         A_POP3,
40         A_APOP,
41         A_RPOP,
42         A_IMAP4,
43         A_NNTP,
44         A_LOCAL
45 } RecvProtocol;
46
47 typedef enum {
48         SIG_FILE,
49         SIG_COMMAND,
50         SIG_DIRECT
51 } SigType;
52
53 typedef enum {
54         /* login and retrieve messages, as before */
55         STYPE_NORMAL,
56         /* send TOP to server and retrieve all available Headers */
57         STYPE_PREVIEW_ALL,
58         /* send TOP to server and retrieve new Headers */
59         STYPE_PREVIEW_NEW,
60         /* delete selected Headers on Server */
61         STYPE_DELETE, 
62         /* download + remove Mail from Server */
63         STYPE_DOWNLOAD,
64         /* just login (pop before smtp) */
65         STYPE_POP_BEFORE_SMTP,
66 } Pop3SessionType;
67
68 #if USE_GPGME
69 typedef enum {
70         SIGN_KEY_DEFAULT,
71         SIGN_KEY_BY_FROM,
72         SIGN_KEY_CUSTOM
73 } SignKeyType;
74
75 typedef enum {
76         GNUPG_MODE_DETACH,
77         GNUPG_MODE_INLINE
78 } DefaultGnuPGMode;
79 #endif /* USE_GPGME */
80
81 struct _PrefsAccount
82 {
83         gchar *account_name;
84
85         /* Personal info */
86         gchar *name;
87         gchar *address;
88         gchar *organization;
89
90         /* Server info */
91         RecvProtocol protocol;
92         gchar *recv_server;
93         gchar *smtp_server;
94         gchar *nntp_server;
95         gboolean use_nntp_auth;
96         gboolean use_nntp_auth_onconnect;
97         gchar *userid;
98         gchar *passwd;
99
100         gchar * local_mbox;
101         gboolean use_mail_command;
102         gchar * mail_command;
103
104 #if USE_OPENSSL
105         SSLType ssl_pop;
106         SSLType ssl_imap;
107         SSLType ssl_nntp;
108         SSLType ssl_smtp;
109 #endif /* USE_OPENSSL */
110
111         /* Temporarily preserved password */
112         gchar *tmp_pass;
113
114         /* Receive */
115         gboolean rmmail;
116         gint msg_leave_time;
117         gboolean getall;
118         gboolean recv_at_getall;
119         gboolean sd_rmmail_on_download;
120         gboolean sd_filter_on_recv;
121         gboolean enable_size_limit;
122         gint size_limit;
123         gboolean filter_on_recv;
124         gchar *inbox;
125         gint max_articles;
126
127         /* selective Download */
128         gint   session;
129         GSList *msg_list;
130
131         /* Send */
132         gboolean add_date;
133         gboolean gen_msgid;
134         gboolean add_customhdr;
135         gboolean use_smtp_auth;
136         SMTPAuthType smtp_auth_type;
137         gchar *smtp_userid;
138         gchar *smtp_passwd;
139
140         /* Temporarily preserved password */
141         gchar *tmp_smtp_pass;
142
143         gboolean pop_before_smtp;
144         gint pop_before_smtp_timeout;
145         time_t last_pop_login_time;
146
147         GSList *customhdr_list;
148
149         /* Compose */
150         SigType sig_type;
151         gchar    *sig_path;
152         gboolean  auto_sig;
153         gchar    *sig_sep;
154         gboolean  set_autocc;
155         gchar    *auto_cc;
156         gboolean  set_autobcc;
157         gchar    *auto_bcc;
158         gboolean  set_autoreplyto;
159         gchar    *auto_replyto;
160
161 #if USE_GPGME
162         /* Privacy */
163         gboolean default_encrypt;
164         gboolean default_sign;
165         gboolean default_gnupg_mode;
166         SignKeyType sign_key;
167         gchar *sign_key_id;
168 #endif /* USE_GPGME */
169
170         /* Advanced */
171         gboolean  set_smtpport;
172         gushort   smtpport;
173         gboolean  set_popport;
174         gushort   popport;
175         gboolean  set_imapport;
176         gushort   imapport;
177         gboolean  set_nntpport;
178         gushort   nntpport;
179         gboolean  set_domain;
180         gchar    *domain;
181         gboolean  mark_crosspost_read;
182         gint      crosspost_col;
183
184         /* Use this command to open a socket, rather than doing so
185          * directly.  Good if you want to perhaps use a special socks
186          * tunnel command, or run IMAP-over-SSH.  In this case the
187          * server, port etc are only for the user's own information
188          * and are not used.  username and password are used to
189          * authenticate the account only if necessary, since some
190          * tunnels will implicitly authenticate by running e.g. imapd
191          * as a particular user. */
192         gboolean  set_tunnelcmd;
193         gchar     *tunnelcmd;
194
195         gchar *imap_dir;
196
197         gboolean set_sent_folder;
198         gchar *sent_folder;
199         gboolean set_draft_folder;
200         gchar *draft_folder;
201         gboolean set_trash_folder;
202         gchar *trash_folder;
203
204         /* Default or not */
205         gboolean is_default;
206         /* Unique account ID */
207         gint account_id;
208
209         RemoteFolder *folder;
210 };
211
212 PrefsAccount *prefs_account_new         (void);
213
214 void prefs_account_read_config          (PrefsAccount   *ac_prefs,
215                                          const gchar    *label);
216 void prefs_account_save_config_all      (GList          *account_list);
217
218 void prefs_account_free                 (PrefsAccount   *ac_prefs);
219
220 PrefsAccount *prefs_account_open        (PrefsAccount   *ac_prefs);
221
222 #endif /* __PREFS_ACCOUNT_H__ */