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