2005-09-14 [paul] 1.9.14cvs26
[claws.git] / src / common / session.h
index d747a14576c276a6948d390a87c355033311c2ca..ed2d328b8840e4e5ee9ecc840c227866a012c1f2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,7 +27,6 @@
 #include <glib.h>
 
 #include <time.h>
-#include <sys/time.h>
 #include <unistd.h>
 
 #include "socket.h"
@@ -51,6 +50,7 @@ typedef enum {
        SESSION_SEND,
        SESSION_RECV,
        SESSION_EOF,
+       SESSION_TIMEOUT,
        SESSION_ERROR,
        SESSION_DISCONNECTED
 } SessionState;
@@ -101,7 +101,7 @@ struct _Session
        SessionState state;
 
        time_t last_access_time;
-       struct timeval tv_prev;
+       GTimeVal tv_prev;
 
        gint conn_id;
 
@@ -115,10 +115,19 @@ struct _Session
        GByteArray *read_data_buf;
        gchar *read_data_terminator;
 
+       /* buffer for short messages */
        gchar *write_buf;
        gchar *write_buf_p;
        gint write_buf_len;
 
+       /* buffer for large data */
+       const guchar *write_data;
+       const guchar *write_data_p;
+       gint write_data_len;
+
+       guint timeout_tag;
+       guint timeout_interval;
+
        gpointer data;
 
        /* virtual methods to parse server responses */
@@ -155,6 +164,11 @@ gint session_disconnect            (Session        *session);
 void session_destroy           (Session        *session);
 gboolean session_is_connected  (Session        *session);
 
+void session_set_access_time   (Session        *session);
+
+void session_set_timeout       (Session        *session,
+                                guint           interval);
+
 void session_set_recv_message_notify   (Session        *session,
                                         RecvMsgNotify   notify_func,
                                         gpointer        data);