aboutsummaryrefslogtreecommitdiff
path: root/libsylph/prefs_account.h
blob: df012c9878452a57be63a77ab6e3e920813205e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*
 * LibSylph -- E-Mail client library
 * Copyright (C) 1999-2010 Hiroyuki Yamamoto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __PREFS_ACCOUNT_H__
#define __PREFS_ACCOUNT_H__

#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

#include <glib.h>

typedef struct _PrefsAccount	PrefsAccount;

#include "folder.h"
#include "smtp.h"
#include "prefs.h"

typedef enum {
	A_POP3,
	A_APOP,	/* deprecated */
	A_RPOP,	/* deprecated */
	A_IMAP4,
	A_NNTP,
	A_LOCAL
} RecvProtocol;

typedef enum {
	SIG_FILE,
	SIG_COMMAND,
	SIG_DIRECT
} SigType;

typedef enum {
	SIGN_KEY_DEFAULT,
	SIGN_KEY_BY_FROM,
	SIGN_KEY_CUSTOM
} SignKeyType;

struct _PrefsAccount
{
	gchar *account_name;

	/* Personal info */
	gchar *name;
	gchar *address;
	gchar *organization;

	/* Server info */
	RecvProtocol protocol;
	gchar *recv_server;
	gchar *smtp_server;
	gchar *nntp_server;
	gboolean use_nntp_auth;
	gchar *userid;
	gchar *passwd;

	/* SSL */
	gint ssl_pop;
	gint ssl_imap;
	gint ssl_nntp;
	gint ssl_smtp;
	gboolean use_nonblocking_ssl;

	/* Temporarily preserved password */
	gchar *tmp_pass;

	/* Receive */
	gboolean use_apop_auth;
	gboolean rmmail;
	gint msg_leave_time;
	gboolean getall;
	gboolean enable_size_limit;
	gint size_limit;
	gboolean filter_on_recv;
	gchar *inbox;

	gboolean imap_check_inbox_only;
	gboolean imap_filter_inbox_on_recv;
	gint imap_auth_type;

	gint max_nntp_articles;

	gboolean recv_at_getall;

	/* Send */
	gboolean add_date;
	gboolean gen_msgid;
	gboolean add_customhdr;
	gboolean use_smtp_auth;
	SMTPAuthType smtp_auth_type;
	gchar *smtp_userid;
	gchar *smtp_passwd;

	/* Temporarily preserved password */
	gchar *tmp_smtp_pass;

	gboolean pop_before_smtp;

	GSList *customhdr_list;

	/* Compose */
	SigType sig_type;
	gchar *sig_path;
	gchar *sig_text;
	gboolean  set_autocc;
	gchar    *auto_cc;
	gboolean  set_autobcc;
	gchar    *auto_bcc;
	gboolean  set_autoreplyto;
	gchar    *auto_replyto;

	/* Privacy */
	gboolean default_sign;
	gboolean default_encrypt;
	gboolean ascii_armored;
	gboolean clearsign;
	gboolean encrypt_reply;

	SignKeyType sign_key;
	gchar *sign_key_id;

	/* Advanced */
	gboolean  set_smtpport;
	gushort   smtpport;
	gboolean  set_popport;
	gushort   popport;
	gboolean  set_imapport;
	gushort   imapport;
	gboolean  set_nntpport;
	gushort   nntpport;
	gboolean  set_domain;
	gchar    *domain;

	gchar *imap_dir;
	gboolean imap_clear_cache_on_exit;

	gboolean set_sent_folder;
	gchar *sent_folder;
	gboolean set_draft_folder;
	gchar *draft_folder;
	gboolean set_queue_folder;
	gchar *queue_folder;
	gboolean set_trash_folder;
	gchar *trash_folder;

	/* Default or not */
	gboolean is_default;
	/* Unique account ID */
	gint account_id;

	RemoteFolder *folder;

	/* Compose */
	gboolean  sig_before_quote;

	/* SOCKS proxy */
	gboolean use_socks;
	gboolean use_socks_for_recv;
	gboolean use_socks_for_send;
	gint socks_type;
	gchar *proxy_host;
	gushort proxy_port;
	gboolean use_proxy_auth;
	gchar *proxy_name;
	gchar *proxy_pass;
};

PrefsAccount *prefs_account_new		(void);

PrefsAccount *prefs_account_get_tmp_prefs	(void);
void prefs_account_set_tmp_prefs		(PrefsAccount	*ac_prefs);
void prefs_account_apply_tmp_prefs		(PrefsAccount	*ac_prefs);
PrefParam *prefs_account_get_params		(void);

void prefs_account_read_config		(PrefsAccount	*ac_prefs,
					 const gchar	*label);
void prefs_account_write_config_all	(GList		*account_list);

void prefs_account_free			(PrefsAccount	*ac_prefs);

#endif /* __PREFS_ACCOUNT_H__ */