match Nickname on auto-address completion
[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
103         /* Receive */
104         gboolean rmmail;
105         gchar *leave_time;      
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
127         /* Temporarily preserved password */
128         gchar *tmp_smtp_pass;
129
130         gboolean pop_before_smtp;
131
132         GSList *customhdr_list;
133
134         /* Compose */
135         gchar *sig_path;
136         gboolean  set_autocc;
137         gchar    *auto_cc;
138         gboolean  set_autobcc;
139         gchar    *auto_bcc;
140         gboolean  set_autoreplyto;
141         gchar    *auto_replyto;
142
143 #if USE_GPGME
144         /* Privacy */
145         gboolean default_encrypt;
146         gboolean ascii_armored;
147         gboolean default_sign;
148         SignKeyType sign_key;
149         gchar *sign_key_id;
150 #endif /* USE_GPGME */
151
152         /* Advanced */
153         gboolean  set_smtpport;
154         gushort   smtpport;
155         gboolean  set_popport;
156         gushort   popport;
157         gboolean  set_imapport;
158         gushort   imapport;
159         gboolean  set_nntpport;
160         gushort   nntpport;
161         gboolean  set_domain;
162         gchar    *domain;
163         gboolean  mark_crosspost_read;
164         gint      crosspost_col;
165
166         /* Use this command to open a socket, rather than doing so
167          * directly.  Good if you want to perhaps use a special socks
168          * tunnel command, or run IMAP-over-SSH.  In this case the
169          * server, port etc are only for the user's own information
170          * and are not used.  username and password are used to
171          * authenticate the account only if necessary, since some
172          * tunnels will implicitly authenticate by running e.g. imapd
173          * as a particular user. */
174         gboolean  set_tunnelcmd;
175         gchar     *tunnelcmd;
176
177         /* Default or not */
178         gboolean is_default;
179         /* Unique account ID */
180         gint account_id;
181
182         RemoteFolder *folder;
183 };
184
185 void prefs_account_read_config          (PrefsAccount   *ac_prefs,
186                                          const gchar    *label);
187 void prefs_account_save_config          (PrefsAccount   *ac_prefs);
188 void prefs_account_save_config_all      (GList          *account_list);
189 void prefs_account_free                 (PrefsAccount   *ac_prefs);
190 PrefsAccount *prefs_account_open        (PrefsAccount   *ac_prefs);
191
192 #endif /* __PREFS_ACCOUNT_H__ */