2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
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/>.
24 #include "claws-features.h"
34 #define SESSION_BUFFSIZE 4096
36 typedef struct _Session Session
;
38 #define SESSION(obj) ((Session *)obj)
58 typedef gint (*RecvMsgNotify
) (Session
*session
,
61 typedef gint (*RecvDataProgressiveNotify
) (Session
*session
,
65 typedef gint (*RecvDataNotify
) (Session
*session
,
68 typedef gint (*SendDataProgressiveNotify
) (Session
*session
,
72 typedef gint (*SendDataNotify
) (Session
*session
,
89 time_t last_access_time
;
96 gchar read_buf
[SESSION_BUFFSIZE
];
100 GString
*read_msg_buf
;
101 GByteArray
*read_data_buf
;
102 gchar
*read_data_terminator
;
104 /* buffer for short messages */
109 /* buffer for large data */
110 const guchar
*write_data
;
111 const guchar
*write_data_p
;
115 guint timeout_interval
;
119 /* virtual methods to parse server responses */
120 gint (*recv_msg
) (Session
*session
,
123 void (*connect_finished
) (Session
*session
,
125 gint (*send_data_finished
) (Session
*session
,
127 gint (*recv_data_finished
) (Session
*session
,
131 void (*destroy
) (Session
*session
);
133 /* notification functions */
134 RecvMsgNotify recv_msg_notify
;
135 RecvDataProgressiveNotify recv_data_progressive_notify
;
136 RecvDataNotify recv_data_notify
;
137 SendDataProgressiveNotify send_data_progressive_notify
;
138 SendDataNotify send_data_notify
;
140 gpointer recv_msg_notify_data
;
141 gpointer recv_data_progressive_notify_data
;
142 gpointer recv_data_notify_data
;
143 gpointer send_data_progressive_notify_data
;
144 gpointer send_data_notify_data
;
148 gboolean ssl_cert_auto_accept
;
153 gchar
*gnutls_priority
;
157 void session_init (Session
*session
,
158 const void *prefs_account
,
160 gint
session_connect (Session
*session
,
163 gint
session_disconnect (Session
*session
);
164 void session_destroy (Session
*session
);
165 gboolean
session_is_running (Session
*session
);
166 gboolean
session_is_connected (Session
*session
);
168 void session_set_access_time (Session
*session
);
170 void session_set_timeout (Session
*session
,
173 void session_set_recv_message_notify (Session
*session
,
174 RecvMsgNotify notify_func
,
176 void session_set_recv_data_progressive_notify
178 RecvDataProgressiveNotify notify_func
,
180 void session_set_recv_data_notify (Session
*session
,
181 RecvDataNotify notify_func
,
183 void session_set_send_data_progressive_notify
185 SendDataProgressiveNotify notify_func
,
187 void session_set_send_data_notify (Session
*session
,
188 SendDataNotify notify_func
,
192 gint
session_start_tls (Session
*session
);
195 gint
session_send_msg (Session
*session
,
197 gint
session_recv_msg (Session
*session
);
198 gint
session_send_data (Session
*session
,
201 gint
session_recv_data (Session
*session
,
203 const gchar
*terminator
);
204 void session_register_ping(Session
*session
, gboolean (*ping_cb
)(gpointer data
));
206 #endif /* __SESSION_H__ */