2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2015 the Claws Mail team
4 * Copyright (C) 2014-2015 Charles Lehner
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "prefs_account.h"
28 #define SIEVE_SESSION(obj) ((SieveSession *)obj)
29 #define SIEVE_PORT 4190
31 typedef struct SieveSession SieveSession
;
32 typedef struct SieveCommand SieveCommand
;
33 typedef struct SieveScript SieveScript
;
34 typedef struct SieveResult SieveResult
;
40 SE_UNRECOVERABLE
= 129,
54 SIEVEAUTH_PLAIN
= 1 << 0,
55 SIEVEAUTH_LOGIN
= 1 << 1,
56 SIEVEAUTH_CRAM_MD5
= 1 << 2,
69 SIEVE_AUTH_LOGIN_USER
,
70 SIEVE_AUTH_LOGIN_PASS
,
98 typedef void (*sieve_session_cb_fn
) (SieveSession
*session
, gpointer data
);
99 typedef void (*sieve_session_data_cb_fn
) (SieveSession
*session
,
100 gboolean aborted
, gpointer cb_data
, gpointer user_data
);
101 typedef void (*sieve_session_error_cb_fn
) (SieveSession
*session
,
102 const gchar
*msg
, gpointer user_data
);
103 typedef void (*sieve_session_connected_cb_fn
) (SieveSession
*session
,
104 gboolean connected
, gpointer user_data
);
109 PrefsAccount
*account
;
110 struct SieveAccountConfig
*config
;
112 gboolean authenticated
;
114 SieveErrorValue error
;
115 SieveCommand
*current_cmd
;
116 guint octets_remaining
;
119 SieveAuthType avail_auth_type
;
120 SieveAuthType forced_auth_type
;
121 SieveAuthType auth_type
;
129 gboolean tls_init_done
;
136 sieve_session_error_cb_fn on_error
;
137 sieve_session_connected_cb_fn on_connected
;
141 struct SieveCommand
{
142 SieveSession
*session
;
143 SieveState next_state
;
145 sieve_session_data_cb_fn cb
;
157 SieveResponseCode code
;
163 void sieve_sessions_close();
165 void sieve_account_prefs_updated(PrefsAccount
*account
);
166 SieveSession
*sieve_session_get_for_account(PrefsAccount
*account
);
167 void sieve_sessions_discard_callbacks(gpointer user_data
);
168 void sieve_session_handle_status(SieveSession
*session
,
169 sieve_session_error_cb_fn on_error
,
170 sieve_session_connected_cb_fn on_connected
,
172 void sieve_session_list_scripts(SieveSession
*session
,
173 sieve_session_data_cb_fn got_script_name_cb
, gpointer data
);
174 void sieve_session_set_active_script(SieveSession
*session
,
175 const gchar
*filter_name
,
176 sieve_session_data_cb_fn cb
, gpointer data
);
177 void sieve_session_rename_script(SieveSession
*session
,
178 const gchar
*name_old
, const char *name_new
,
179 sieve_session_data_cb_fn cb
, gpointer data
);
180 void sieve_session_get_script(SieveSession
*session
, const gchar
*filter_name
,
181 sieve_session_data_cb_fn cb
, gpointer data
);
182 void sieve_session_put_script(SieveSession
*session
, const gchar
*filter_name
,
183 gint len
, const gchar
*script_contents
,
184 sieve_session_data_cb_fn cb
, gpointer data
);
185 void sieve_session_check_script(SieveSession
*session
,
186 gint len
, const gchar
*script_contents
,
187 sieve_session_data_cb_fn cb
, gpointer data
);
188 void sieve_session_delete_script(SieveSession
*session
,
189 const gchar
*filter_name
,
190 sieve_session_data_cb_fn cb
, gpointer data
);
192 #endif /* MANAGESIEVE_H */