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