Removed SessionMsgType enum and its use, since it is useless.
[claws.git] / src / common / session.h
index f192721d32965f0a486f5138b40c275af507ded7..72b451261c5a08eec72b67c79b511cdf85760c1f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
@@ -21,7 +21,7 @@
 #define __SESSION_H__
 
 #ifdef HAVE_CONFIG_H
-#  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include <glib.h>
@@ -55,16 +55,6 @@ typedef enum {
        SESSION_DISCONNECTED
 } SessionState;
 
-typedef enum
-{
-       SESSION_MSG_NORMAL,
-       SESSION_MSG_SEND_DATA,
-       SESSION_MSG_RECV_DATA,
-       SESSION_MSG_CONTROL,
-       SESSION_MSG_ERROR,
-       SESSION_MSG_UNKNOWN
-} SessionMsgType;
-
 typedef gint (*RecvMsgNotify)                  (Session        *session,
                                                 const gchar    *msg,
                                                 gpointer        user_data);
@@ -92,10 +82,6 @@ struct _Session
        gchar *server;
        gushort port;
 
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
-       SSLType ssl_type;
-#endif
-
        gboolean nonblocking;
 
        SessionState state;
@@ -134,6 +120,8 @@ struct _Session
        gint (*recv_msg)                (Session        *session,
                                         const gchar    *msg);
 
+       void (*connect_finished)        (Session        *session,
+                                        gboolean       success);
        gint (*send_data_finished)      (Session        *session,
                                         guint           len);
        gint (*recv_data_finished)      (Session        *session,
@@ -154,14 +142,27 @@ struct _Session
        gpointer recv_data_notify_data;
        gpointer send_data_progressive_notify_data;
        gpointer send_data_notify_data;
+
+       const void *account;
+       gboolean is_smtp;
+       gboolean ssl_cert_auto_accept;
+       gint ping_tag;
+
+#ifdef USE_GNUTLS
+       SSLType ssl_type;
+       gchar *gnutls_priority;
+#endif
 };
 
-void session_init              (Session        *session);
+void session_init              (Session        *session, 
+                                const void     *prefs_account,
+                                gboolean        is_smtp);
 gint session_connect           (Session        *session,
                                 const gchar    *server,
                                 gushort         port);
 gint session_disconnect                (Session        *session);
 void session_destroy           (Session        *session);
+gboolean session_is_running    (Session        *session);
 gboolean session_is_connected  (Session        *session);
 
 void session_set_access_time   (Session        *session);
@@ -187,12 +188,11 @@ void session_set_send_data_notify (Session        *session,
                                         SendDataNotify  notify_func,
                                         gpointer        data);
 
-#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
+#ifdef USE_GNUTLS
 gint session_start_tls (Session        *session);
 #endif
 
 gint session_send_msg  (Session        *session,
-                        SessionMsgType  type,
                         const gchar    *msg);
 gint session_recv_msg  (Session        *session);
 gint session_send_data (Session        *session,
@@ -201,5 +201,6 @@ gint session_send_data      (Session        *session,
 gint session_recv_data (Session        *session,
                         guint           size,
                         const gchar    *terminator);
+void session_register_ping(Session *session, gboolean (*ping_cb)(gpointer data));
 
 #endif /* __SESSION_H__ */