prefs_account.h (4546B)
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 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 3 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, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef PREFS_ACCOUNT_H 21 #define PREFS_ACCOUNT_H 22 23 #include "ssl.h" 24 typedef struct _PrefsAccount PrefsAccount; 25 26 typedef enum { 27 A_POP3, 28 A_IMAP4, 29 A_LOCAL, 30 A_NONE, /* SMTP only */ 31 NUM_RECV_PROTOCOLS 32 } RecvProtocol; 33 34 typedef enum 35 { 36 POPAUTH_OAUTH2 = 1 << 1 37 } POPAuthType; 38 39 #include <glib.h> 40 41 #include "smtp.h" 42 #include "pop.h" 43 #include "gtk/prefswindow.h" 44 45 struct _Folder; 46 47 struct _PrefsAccount 48 { 49 gchar *account_name; 50 51 /* Personal info */ 52 gchar *name; 53 gchar *address; 54 55 /* Server info */ 56 RecvProtocol protocol; 57 gchar *recv_server; 58 gchar *smtp_server; 59 gchar *userid; 60 gchar *passwd; 61 gchar *session_passwd; 62 63 gchar * local_mbox; 64 gboolean use_mail_command; 65 gchar * mail_command; 66 67 SSLType ssl_pop; 68 SSLType ssl_imap; 69 SSLType ssl_smtp; 70 71 gchar *out_ssl_client_cert_file; 72 gchar *out_ssl_client_cert_pass; 73 gchar *in_ssl_client_cert_file; 74 gchar *in_ssl_client_cert_pass; 75 76 gboolean use_nonblocking_ssl; 77 gboolean use_tls_sni; 78 79 /* Receive */ 80 gboolean use_pop_auth; 81 POPAuthType pop_auth_type; 82 gboolean rmmail; 83 gint msg_leave_time; 84 gint msg_leave_hour; 85 gboolean recv_at_getall; 86 gboolean sd_rmmail_on_download; 87 gchar *inbox; 88 gchar *local_inbox; 89 gint max_articles; 90 91 gint imap_auth_type; 92 guint imap_batch_size; 93 94 gboolean receive_in_progress; 95 96 /* Send */ 97 gboolean gen_msgid; 98 gboolean gen_xmailer; 99 gboolean add_customhdr; 100 gboolean use_smtp_auth; 101 SMTPAuthType smtp_auth_type; 102 gchar *smtp_userid; 103 gchar *smtp_passwd; 104 gchar *session_smtp_passwd; 105 106 gboolean pop_before_smtp; 107 gint pop_before_smtp_timeout; 108 time_t last_pop_login_time; 109 110 GSList *customhdr_list; 111 112 /* OAuth2 */ 113 gint oauth2_provider; 114 gint oauth2_date; 115 gchar *oauth2_authcode; 116 gchar *oauth2_client_id; 117 gchar *oauth2_client_secret; 118 119 /* Compose */ 120 gboolean set_autocc; 121 gchar *auto_cc; 122 gboolean set_autobcc; 123 gchar *auto_bcc; 124 gboolean set_autoreplyto; 125 gchar *auto_replyto; 126 127 /* Advanced */ 128 gboolean set_smtpport; 129 gushort smtpport; 130 gboolean set_popport; 131 gushort popport; 132 gboolean set_imapport; 133 gushort imapport; 134 gboolean set_domain; 135 gchar *domain; 136 gboolean set_gnutls_priority; 137 gchar *gnutls_priority; 138 gboolean msgid_with_addr; 139 gboolean mark_crosspost_read; 140 gint crosspost_col; 141 142 /* Use this command to open a socket, rather than doing so 143 * directly. Good if you want to perhaps use a special socks 144 * tunnel command, or run IMAP-over-SSH. In this case the 145 * server, port etc are only for the user's own information 146 * and are not used. username and password are used to 147 * authenticate the account only if necessary, since some 148 * tunnels will implicitly authenticate by running e.g. imapd 149 * as a particular user. */ 150 gboolean set_tunnelcmd; 151 gchar *tunnelcmd; 152 153 gchar *imap_dir; 154 gboolean imap_subsonly; 155 156 gboolean set_sent_folder; 157 gchar *sent_folder; 158 gboolean set_queue_folder; 159 gchar *queue_folder; 160 gboolean set_draft_folder; 161 gchar *draft_folder; 162 gboolean set_trash_folder; 163 gchar *trash_folder; 164 165 gboolean is_default; 166 /* Unique account ID */ 167 gint account_id; 168 169 struct _Folder *folder; 170 SMTPSession *session; 171 172 gint config_version; 173 }; 174 175 void prefs_account_init (void); 176 177 PrefsAccount *prefs_account_new (void); 178 PrefsAccount *prefs_account_new_from_config (const gchar *label); 179 180 void prefs_account_write_config_all (GList *account_list); 181 182 void prefs_account_free (PrefsAccount *ac_prefs); 183 184 PrefsAccount *prefs_account_open (PrefsAccount *ac_prefs, gboolean *dirty); 185 186 gchar *prefs_account_generate_msgid(PrefsAccount *account); 187 188 void prefs_account_register_page (PrefsPage *page); 189 void prefs_account_unregister_page (PrefsPage *page); 190 191 char *prefs_account_cache_dir (const char *server, const char *userid); 192 193 #endif /* PREFS_ACCOUNT_H */