[Commits] session.c 1.23.2.28 1.23.2.29 session.h 1.8.2.21 1.8.2.22

colin at claws-mail.org colin at claws-mail.org
Wed Nov 28 12:01:26 CET 2012


Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv22149/src/common

Modified Files:
      Tag: gtk2
	session.c session.h 
Log Message:
2012-11-28 [colin]	3.9.0cvs27

	* src/imap.c
	* src/news.c
	* src/common/session.c
	* src/common/session.h
		Add keep-alive pings on IMAP and NNTP

Index: session.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/session.c,v
retrieving revision 1.23.2.28
retrieving revision 1.23.2.29
diff -u -d -r1.23.2.28 -r1.23.2.29
--- session.c	7 Jul 2012 07:09:31 -0000	1.23.2.28
+++ session.c	28 Nov 2012 11:01:24 -0000	1.23.2.29
@@ -100,6 +100,8 @@
 	session->data = NULL;
 	session->account = prefs_account;
 	session->is_smtp = is_smtp;
+
+	session->ping_tag = -1;
 }
 
 /*!
@@ -215,6 +217,8 @@
 	cm_return_if_fail(session != NULL);
 	cm_return_if_fail(session->destroy != NULL);
 
+	session_register_ping(session, NULL);
+
 	session_close(session);
 	session->destroy(session);
 	g_free(session->server);
@@ -867,3 +871,22 @@
 
 	return FALSE;
 }
+
+void session_register_ping(Session *session, gboolean (*ping_cb)(gpointer data))
+{
+	if (!session)
+		return;
+	if (session->ping_tag > -1)
+		g_source_remove(session->ping_tag);
+
+	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
+}

Index: session.h
===================================================================
RCS file: /home/claws-mail/claws/src/common/session.h,v
retrieving revision 1.8.2.21
retrieving revision 1.8.2.22
diff -u -d -r1.8.2.21 -r1.8.2.22
--- session.h	7 Jul 2012 07:30:56 -0000	1.8.2.21
+++ session.h	28 Nov 2012 11:01:24 -0000	1.8.2.22
@@ -154,6 +154,8 @@
 	const void *account;
 	gboolean is_smtp;
 
+	gint ping_tag;
+
 #ifdef USE_GNUTLS
 	SSLType ssl_type;
 #endif
@@ -207,5 +209,6 @@
 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__ */



More information about the Commits mailing list