sync with 0.7.4cvs21
[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         gboolean ssl_nntp;
98         SSLSMTPType ssl_smtp;
99 #endif /* USE_SSL */
100
101         /* Temporarily preserved password */
102         gchar *tmp_pass;
103
104         /* Receive */
105         gboolean rmmail;
106         gchar *leave_time;      
107         gboolean getall;
108         gboolean recv_at_getall;
109         gboolean enable_size_limit;
110         gint size_limit;
111         gboolean filter_on_recv;
112         gchar *inbox;
113
114         /* selective Download */
115         gint   session_type;
116         GSList *to_delete;
117
118         gchar *imap_dir;
119
120         /* Send */
121         gboolean add_date;
122         gboolean gen_msgid;
123         gboolean add_customhdr;
124         gboolean use_smtp_auth;
125         gchar *smtp_userid;
126         gchar *smtp_passwd;
127
128         /* Temporarily preserved password */
129         gchar *tmp_smtp_pass;
130
131         gboolean pop_before_smtp;
132
133         GSList *customhdr_list;
134
135         /* Compose */
136         gchar *sig_path;
137         gboolean  set_autocc;
138         gchar    *auto_cc;
139         gboolean  set_autobcc;
140         gchar    *auto_bcc;
141         gboolean  set_autoreplyto;
142         gchar    *auto_replyto;
143
144 #if USE_GPGME
145         /* Privacy */
146         gboolean default_encrypt;
147         gboolean ascii_armored;
148         gboolean default_sign;
149         SignKeyType sign_key;
150         gchar *sign_key_id;
151 #endif /* USE_GPGME */
152
153         /* Advanced */
154         gboolean  set_smtpport;
155         gushort   smtpport;
156         gboolean  set_popport;
157         gushort   popport;
158         gboolean  set_imapport;
159         gushort   imapport;
160         gboolean  set_nntpport;
161         gushort   nntpport;
162         gboolean  set_domain;
163         gchar    *domain;
164         gboolean  mark_crosspost_read;
165         gint      crosspost_col;
166
167         /* Use this command to open a socket, rather than doing so
168          * directly.  Good if you want to perhaps use a special socks
169          * tunnel command, or run IMAP-over-SSH.  In this case the
170          * server, port etc are only for the user's own information
171          * and are not used.  username and password are used to
172          * authenticate the account only if necessary, since some
173          * tunnels will implicitly authenticate by running e.g. imapd
174          * as a particular user. */
175         gboolean  set_tunnelcmd;
176         gchar     *tunnelcmd;
177
178         /* Default or not */
179         gboolean is_default;
180         /* Unique account ID */
181         gint account_id;
182
183         RemoteFolder *folder;
184 };
185
186 void prefs_account_read_config          (PrefsAccount   *ac_prefs,
187                                          const gchar    *label);
188 void prefs_account_save_config          (PrefsAccount   *ac_prefs);
189 void prefs_account_save_config_all      (GList          *account_list);
190 void prefs_account_free                 (PrefsAccount   *ac_prefs);
191 PrefsAccount *prefs_account_open        (PrefsAccount   *ac_prefs);
192
193 #endif /* __PREFS_ACCOUNT_H__ */