move 'Maximum number of articles to download' to account prefs
[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         gboolean use_nntp_auth_onconnect;
91         gchar *userid;
92         gchar *passwd;
93
94         gchar * local_mbox;
95         gboolean use_mail_command;
96         gchar * mail_command;
97
98 #if USE_OPENSSL
99         SSLType ssl_pop;
100         SSLType ssl_imap;
101         SSLType ssl_nntp;
102         SSLType ssl_smtp;
103 #endif /* USE_OPENSSL */
104
105         /* Temporarily preserved password */
106         gchar *tmp_pass;
107
108         /* Receive */
109         gboolean rmmail;
110         gint msg_leave_time;
111         gboolean getall;
112         gboolean recv_at_getall;
113         gboolean sd_rmmail_on_download;
114         gboolean sd_filter_on_recv;
115         gboolean enable_size_limit;
116         gint size_limit;
117         gboolean filter_on_recv;
118         gchar *inbox;
119         gint max_articles;
120
121         /* selective Download */
122         gint   session;
123         GSList *msg_list;
124
125         /* Send */
126         gboolean add_date;
127         gboolean gen_msgid;
128         gboolean add_customhdr;
129         gboolean use_smtp_auth;
130         SMTPAuthType smtp_auth_type;
131         gchar *smtp_userid;
132         gchar *smtp_passwd;
133
134         /* Temporarily preserved password */
135         gchar *tmp_smtp_pass;
136
137         gboolean pop_before_smtp;
138         gint pop_before_smtp_timeout;
139         time_t last_pop_login_time;
140
141         GSList *customhdr_list;
142
143         /* Compose */
144         gchar    *sig_path;
145         gboolean  auto_sig;
146         gchar    *sig_sep;
147         gboolean  set_autocc;
148         gchar    *auto_cc;
149         gboolean  set_autobcc;
150         gchar    *auto_bcc;
151         gboolean  set_autoreplyto;
152         gchar    *auto_replyto;
153
154 #if USE_GPGME
155         /* Privacy */
156         gboolean default_encrypt;
157         gboolean default_sign;
158         gboolean default_gnupg_mode;
159         SignKeyType sign_key;
160         gchar *sign_key_id;
161 #endif /* USE_GPGME */
162
163         /* Advanced */
164         gboolean  set_smtpport;
165         gushort   smtpport;
166         gboolean  set_popport;
167         gushort   popport;
168         gboolean  set_imapport;
169         gushort   imapport;
170         gboolean  set_nntpport;
171         gushort   nntpport;
172         gboolean  set_domain;
173         gchar    *domain;
174         gboolean  mark_crosspost_read;
175         gint      crosspost_col;
176
177         /* Use this command to open a socket, rather than doing so
178          * directly.  Good if you want to perhaps use a special socks
179          * tunnel command, or run IMAP-over-SSH.  In this case the
180          * server, port etc are only for the user's own information
181          * and are not used.  username and password are used to
182          * authenticate the account only if necessary, since some
183          * tunnels will implicitly authenticate by running e.g. imapd
184          * as a particular user. */
185         gboolean  set_tunnelcmd;
186         gchar     *tunnelcmd;
187
188         gchar *imap_dir;
189
190         gboolean set_sent_folder;
191         gchar *sent_folder;
192         gboolean set_draft_folder;
193         gchar *draft_folder;
194         gboolean set_trash_folder;
195         gchar *trash_folder;
196
197         /* Default or not */
198         gboolean is_default;
199         /* Unique account ID */
200         gint account_id;
201
202         RemoteFolder *folder;
203 };
204
205 PrefsAccount *prefs_account_new         (void);
206
207 void prefs_account_read_config          (PrefsAccount   *ac_prefs,
208                                          const gchar    *label);
209 void prefs_account_save_config_all      (GList          *account_list);
210
211 void prefs_account_free                 (PrefsAccount   *ac_prefs);
212
213 PrefsAccount *prefs_account_open        (PrefsAccount   *ac_prefs);
214
215 #endif /* __PREFS_ACCOUNT_H__ */