Fix CID 1491093: attrib leaked if attvalue is null
[claws.git] / src / prefs_account.h
blob174f98a134726ee4a6d78029b698142f2e28037d
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2023 the Claws Mail team and Hiroyuki Yamamoto
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 3 of the License, or
8 * (at your option) any later version.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef PREFS_ACCOUNT_H
21 #define PREFS_ACCOUNT_H
23 #ifdef HAVE_CONFIG_H
24 #include "claws-features.h"
25 #endif
26 #include "ssl.h"
27 typedef struct _PrefsAccount PrefsAccount;
29 typedef enum {
30 A_POP3,
31 A_IMAP4,
32 A_NNTP,
33 A_LOCAL,
34 A_NONE, /* SMTP only */
35 NUM_RECV_PROTOCOLS
36 } RecvProtocol;
38 typedef enum {
39 SIG_FILE,
40 SIG_COMMAND,
41 SIG_DIRECT
42 } SigType;
44 typedef enum
46 POPAUTH_APOP = 1 << 0,
47 POPAUTH_OAUTH2 = 1 << 1
48 } POPAuthType;
50 #include <glib.h>
52 #include "smtp.h"
53 #include "pop.h"
54 #include "gtk/prefswindow.h"
56 struct _Folder;
58 /* Changes to this data structure might need to be reflected
59 * in account_clone() */
60 struct _PrefsAccount
62 gchar *account_name;
64 /* Personal info */
65 gchar *name;
66 gchar *address;
67 gchar *organization;
69 /* Server info */
70 RecvProtocol protocol;
71 gchar *recv_server;
72 gchar *smtp_server;
73 gchar *nntp_server;
74 gboolean use_nntp_auth;
75 gboolean use_nntp_auth_onconnect;
76 gchar *userid;
77 gchar *passwd;
78 gchar *session_passwd;
80 gchar * local_mbox;
81 gboolean use_mail_command;
82 gchar * mail_command;
84 SSLType ssl_pop;
85 SSLType ssl_imap;
86 SSLType ssl_nntp;
87 SSLType ssl_smtp;
89 gchar *out_ssl_client_cert_file;
90 gchar *out_ssl_client_cert_pass;
91 gchar *in_ssl_client_cert_file;
92 gchar *in_ssl_client_cert_pass;
94 gboolean ssl_certs_auto_accept;
95 gboolean use_nonblocking_ssl;
96 gboolean use_tls_sni;
98 /* Receive */
99 gboolean use_pop_auth;
100 POPAuthType pop_auth_type;
101 gboolean use_apop_auth; /* deprecated */
102 gboolean rmmail;
103 gint msg_leave_time;
104 gint msg_leave_hour;
105 gboolean recv_at_getall;
106 gboolean sd_rmmail_on_download;
107 gboolean enable_size_limit;
108 gint size_limit;
109 gboolean filter_on_recv;
110 gboolean filterhook_on_recv;
111 gchar *inbox;
112 gchar *local_inbox;
113 gint max_articles;
114 gboolean autochk_use_default;
115 gboolean autochk_use_custom;
116 gint autochk_itv;
117 guint autocheck_timer;
119 gint imap_auth_type;
120 guint imap_batch_size;
122 gboolean receive_in_progress;
124 /* Send */
125 gboolean gen_msgid;
126 gboolean gen_xmailer;
127 gboolean add_customhdr;
128 gboolean use_smtp_auth;
129 SMTPAuthType smtp_auth_type;
130 gchar *smtp_userid;
131 gchar *smtp_passwd;
132 gchar *session_smtp_passwd;
134 gboolean pop_before_smtp;
135 gint pop_before_smtp_timeout;
136 time_t last_pop_login_time;
138 GSList *customhdr_list;
140 /* OAuth2 */
141 gint oauth2_provider;
142 gint oauth2_date;
143 gchar *oauth2_authcode;
144 gchar *oauth2_client_id;
145 gchar *oauth2_client_secret;
147 /* Compose */
148 SigType sig_type;
149 gchar *sig_path;
150 gboolean auto_sig;
151 gchar *sig_sep;
152 gboolean set_autocc;
153 gchar *auto_cc;
154 gboolean set_autobcc;
155 gchar *auto_bcc;
156 gboolean set_autoreplyto;
157 gchar *auto_replyto;
158 gboolean enable_default_dictionary;
159 gchar *default_dictionary;
160 gboolean enable_default_alt_dictionary;
161 gchar *default_alt_dictionary;
162 gboolean compose_with_format;
163 gchar *compose_subject_format;
164 gchar *compose_body_format;
165 gboolean reply_with_format;
166 gchar *reply_quotemark;
167 gchar *reply_body_format;
168 gboolean forward_with_format;
169 gchar *forward_quotemark;
170 gchar *forward_body_format;
172 /* Privacy */
173 gchar *default_privacy_system;
174 gboolean default_encrypt;
175 gboolean default_encrypt_reply;
176 gboolean default_sign;
177 gboolean default_sign_reply;
178 gboolean save_encrypted_as_clear_text;
179 gboolean encrypt_to_self;
181 /* Advanced */
182 gboolean set_smtpport;
183 gushort smtpport;
184 gboolean set_popport;
185 gushort popport;
186 gboolean set_imapport;
187 gushort imapport;
188 gboolean set_nntpport;
189 gushort nntpport;
190 gboolean set_domain;
191 gchar *domain;
192 gboolean set_gnutls_priority;
193 gchar *gnutls_priority;
194 gboolean msgid_with_addr;
195 gboolean mark_crosspost_read;
196 gint crosspost_col;
198 #ifndef G_OS_WIN32
199 /* Use this command to open a socket, rather than doing so
200 * directly. Good if you want to perhaps use a special socks
201 * tunnel command, or run IMAP-over-SSH. In this case the
202 * server, port etc are only for the user's own information
203 * and are not used. username and password are used to
204 * authenticate the account only if necessary, since some
205 * tunnels will implicitly authenticate by running e.g. imapd
206 * as a particular user. */
207 gboolean set_tunnelcmd;
208 gchar *tunnelcmd;
209 #endif
211 gchar *imap_dir;
212 gboolean imap_subsonly;
213 gboolean low_bandwidth;
215 gboolean set_sent_folder;
216 gchar *sent_folder;
217 gboolean set_queue_folder;
218 gchar *queue_folder;
219 gboolean set_draft_folder;
220 gchar *draft_folder;
221 gboolean set_trash_folder;
222 gchar *trash_folder;
224 /* Default or not */
225 gboolean is_default;
226 /* Unique account ID */
227 gint account_id;
229 /* SOCKS proxy */
230 gboolean use_proxy;
231 gboolean use_default_proxy;
232 gboolean use_proxy_for_send;
233 ProxyInfo proxy_info;
235 struct _Folder *folder;
236 GHashTable *privacy_prefs;
237 SMTPSession *session;
239 gint config_version;
242 void prefs_account_init (void);
244 PrefsAccount *prefs_account_new (void);
245 PrefsAccount *prefs_account_new_from_config (const gchar *label);
247 void prefs_account_write_config_all (GList *account_list);
249 void prefs_account_free (PrefsAccount *ac_prefs);
251 PrefsAccount *prefs_account_open (PrefsAccount *ac_prefs, gboolean *dirty);
253 const gchar *prefs_account_get_privacy_prefs(PrefsAccount *account, gchar *id);
254 void prefs_account_set_privacy_prefs(PrefsAccount *account, gchar *id, gchar *new_value);
255 gchar *prefs_account_generate_msgid(PrefsAccount *account);
257 void prefs_account_register_page (PrefsPage *page);
258 void prefs_account_unregister_page (PrefsPage *page);
260 gchar *prefs_account_cache_dir (PrefsAccount *ac_prefs, gboolean for_server);
262 #endif /* PREFS_ACCOUNT_H */