add 'Selective download'
[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
33 #ifdef USE_GPGME
34 #  include "rfc2015.h"
35 #endif
36
37 typedef enum {
38         A_POP3,
39         A_APOP,
40         A_RPOP,
41         A_IMAP4,
42         A_NNTP,
43         A_LOCAL
44 } RecvProtocol;
45
46 typedef enum {
47         /* login and retrieve messages, as before */
48         RETR_NORMAL,
49         /* send TOP to server and retrieve Header */
50         RETR_HEADER, 
51         /* delete selected Headers on Server */
52         DELE_HEADER 
53 } Pop3SessionType;
54
55 #if USE_GPGME
56 typedef enum {
57         SIGN_KEY_DEFAULT,
58         SIGN_KEY_BY_FROM,
59         SIGN_KEY_CUSTOM
60 } SignKeyType;
61 #endif /* USE_GPGME */
62
63 #if USE_SSL
64 typedef enum {
65         SSL_SMTP_NONE,
66         SSL_SMTP_TUNNEL,
67         SSL_SMTP_STARTTLS
68 } SSLSMTPType;
69 #endif /* USE_SSL */
70
71 struct _PrefsAccount
72 {
73         gchar *account_name;
74
75         /* Personal info */
76         gchar *name;
77         gchar *address;
78         gchar *organization;
79
80         /* Server info */
81         RecvProtocol protocol;
82         gchar *recv_server;
83         gchar *smtp_server;
84         gchar *nntp_server;
85         gboolean use_nntp_auth;
86         gchar *userid;
87         gchar *passwd;
88
89         gchar * local_mbox;
90         gboolean use_mail_command;
91         gchar * mail_command;
92
93 #if USE_SSL
94         /* SSL */
95         gboolean ssl_pop;
96         gboolean ssl_imap;
97         SSLSMTPType ssl_smtp;
98 #endif /* USE_SSL */
99
100         /* Temporarily preserved password */
101         gchar *tmp_pass;
102         gchar *tmp_smtp_passwd;
103
104         /* Receive */
105         gboolean rmmail;
106         gboolean getall;
107         gboolean recv_at_getall;
108         gboolean enable_size_limit;
109         gint size_limit;
110         gboolean filter_on_recv;
111         gchar *inbox;
112
113         /* selective Download */
114         gint   session_type;
115         GSList *to_delete;
116
117         gchar *imap_dir;
118
119         /* Send */
120         gboolean add_date;
121         gboolean gen_msgid;
122         gboolean add_customhdr;
123         gboolean use_smtp_auth;
124         gchar    *smtp_userid;
125         gchar    *smtp_passwd;
126         gboolean pop_before_smtp;
127
128         GSList *customhdr_list;
129
130         /* Compose */
131         gchar *sig_path;
132         gboolean  set_autocc;
133         gchar    *auto_cc;
134         gboolean  set_autobcc;
135         gchar    *auto_bcc;
136         gboolean  set_autoreplyto;
137         gchar    *auto_replyto;
138
139 #if USE_GPGME
140         /* Privacy */
141         gboolean default_encrypt;
142         gboolean ascii_armored;
143         gboolean default_sign;
144         SignKeyType sign_key;
145         gchar *sign_key_id;
146 #endif /* USE_GPGME */
147
148         /* Advanced */
149         gboolean  set_smtpport;
150         gushort   smtpport;
151         gboolean  set_popport;
152         gushort   popport;
153         gboolean  set_imapport;
154         gushort   imapport;
155         gboolean  set_nntpport;
156         gushort   nntpport;
157         gboolean  set_domain;
158         gchar    *domain;
159
160         /* Use this command to open a socket, rather than doing so
161          * directly.  Good if you want to perhaps use a special socks
162          * tunnel command, or run IMAP-over-SSH.  In this case the
163          * server, port etc are only for the user's own information
164          * and are not used.  username and password are used to
165          * authenticate the account only if necessary, since some
166          * tunnels will implicitly authenticate by running e.g. imapd
167          * as a particular user. */
168         gboolean  set_tunnelcmd;
169         gchar     *tunnelcmd;
170
171         /* Default or not */
172         gboolean is_default;
173         /* Unique account ID */
174         gint account_id;
175
176         RemoteFolder *folder;
177 };
178
179 void prefs_account_read_config          (PrefsAccount   *ac_prefs,
180                                          const gchar    *label);
181 void prefs_account_save_config          (PrefsAccount   *ac_prefs);
182 void prefs_account_save_config_all      (GList          *account_list);
183 void prefs_account_free                 (PrefsAccount   *ac_prefs);
184 PrefsAccount *prefs_account_open        (PrefsAccount   *ac_prefs);
185
186 #endif /* __PREFS_ACCOUNT_H__ */