2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2003 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 2 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, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #define SESSION_BUFFSIZE 4096
37 typedef struct _Session Session;
39 #define SESSION(obj) ((Session *)obj)
60 SESSION_MSG_SEND_DATA,
61 SESSION_MSG_RECV_DATA,
67 typedef gint (*RecvMsgNotify) (Session *session,
70 typedef gint (*RecvDataProgressiveNotify) (Session *session,
74 typedef gint (*RecvDataNotify) (Session *session,
77 typedef gint (*SendDataProgressiveNotify) (Session *session,
81 typedef gint (*SendDataNotify) (Session *session,
100 time_t last_access_time;
101 struct timeval tv_prev;
108 GByteArray *read_data_buf;
109 gchar *read_data_terminator;
117 /* virtual methods to parse server responses */
118 gint (*recv_msg) (Session *session,
121 gint (*send_data_finished) (Session *session,
123 gint (*recv_data_finished) (Session *session,
127 void (*destroy) (Session *session);
129 /* notification functions */
130 RecvMsgNotify recv_msg_notify;
131 RecvDataProgressiveNotify recv_data_progressive_notify;
132 RecvDataNotify recv_data_notify;
133 SendDataProgressiveNotify send_data_progressive_notify;
134 SendDataNotify send_data_notify;
136 gpointer recv_msg_notify_data;
137 gpointer recv_data_progressive_notify_data;
138 gpointer recv_data_notify_data;
139 gpointer send_data_progressive_notify_data;
140 gpointer send_data_notify_data;
143 void session_init (Session *session);
144 gint session_connect (Session *session,
147 gint session_disconnect (Session *session);
148 void session_destroy (Session *session);
150 void session_set_recv_message_notify (Session *session,
151 RecvMsgNotify notify_func,
153 void session_set_recv_data_progressive_notify
155 RecvDataProgressiveNotify notify_func,
157 void session_set_recv_data_notify (Session *session,
158 RecvDataNotify notify_func,
160 void session_set_send_data_progressive_notify
162 SendDataProgressiveNotify notify_func,
164 void session_set_send_data_notify (Session *session,
165 SendDataNotify notify_func,
169 gint session_start_tls (Session *session);
172 gint session_send_msg (Session *session,
175 gint session_recv_msg (Session *session);
176 gint session_send_data (Session *session,
179 gint session_recv_data (Session *session,
181 const gchar *terminator);
183 #endif /* __SESSION_H__ */