fix indent (broken in last commit)
[claws.git] / src / common / session.c
index c43e5e413e92e40873c16b12b015d5c8bf875ddc..959c7a28e6785e6956dd765c893df4476fe371ad 100644 (file)
@@ -165,6 +165,8 @@ static gint session_connect_cb(SockInfo *sock, gpointer data)
        session->sock = sock;
        sock->account = session->account;
        sock->is_smtp = session->is_smtp;
+       sock->ssl_cert_auto_accept = session->ssl_cert_auto_accept;
+
 #ifdef USE_GNUTLS
        sock->gnutls_priority = session->gnutls_priority;
 
@@ -262,14 +264,12 @@ void session_set_timeout(Session *session, guint interval)
 
        session->timeout_interval = interval;
        if (interval > 0) {
-#if GLIB_CHECK_VERSION(2,14,0)
                if (interval % 1000 == 0)
                        session->timeout_tag =
                                g_timeout_add_seconds(interval/1000, session_timeout_cb, session);
                else
-#endif
-               session->timeout_tag =
-                       g_timeout_add(interval, session_timeout_cb, session);
+                       session->timeout_tag =
+                               g_timeout_add(interval, session_timeout_cb, session);
        } else
                session->timeout_tag = 0;
 }
@@ -373,6 +373,8 @@ gint session_start_tls(Session *session)
 
        nb_mode = sock_is_nonblocking_mode(session->sock);
 
+       session->sock->ssl_cert_auto_accept = session->ssl_cert_auto_accept;
+
        if (nb_mode)
                sock_set_nonblocking_mode(session->sock, FALSE);
 
@@ -528,9 +530,10 @@ static gboolean session_read_msg_cb(SockInfo *source, GIOCondition condition,
        session_set_timeout(session, session->timeout_interval);
 
        if (session->read_buf_len == 0) {
-               gint read_len;
+               gint read_len = -1;
 
-               read_len = sock_read(session->sock, session->read_buf,
+               if (session->sock)
+                       read_len = sock_read(session->sock, session->read_buf,
                                     SESSION_BUFFSIZE - 1);
 
                if (read_len == -1 && session->state == SESSION_DISCONNECTED) {
@@ -887,11 +890,5 @@ void session_register_ping(Session *session, gboolean (*ping_cb)(gpointer data))
        session->ping_tag = -1;
 
        if (ping_cb != NULL)
-#if GLIB_CHECK_VERSION(2,14,0)
-               session->ping_tag =
-                       g_timeout_add_seconds(60, ping_cb, session);
-#else
-               session->ping_tag =
-                       g_timeout_add(60*1000, ping_cb, session);
-#endif
+               session->ping_tag = g_timeout_add_seconds(60, ping_cb, session);
 }