changeset 21750:fb8ab2490ac4

De-magic number the prpl_info->keepalive interval, and document it.
author Will Thompson <will.thompson@collabora.co.uk>
date Mon, 03 Dec 2007 19:02:28 +0000
parents d376b1e191b5
children 7632edbf0d00
files libpurple/connection.c libpurple/prpl.h
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.c	Mon Dec 03 16:38:38 2007 +0000
+++ b/libpurple/connection.c	Mon Dec 03 19:02:28 2007 +0000
@@ -38,6 +38,8 @@
 #include "signals.h"
 #include "util.h"
 
+#define KEEPALIVE_INTERVAL 30
+
 static GList *connections = NULL;
 static GList *connections_connecting = NULL;
 static PurpleConnectionUiOps *connection_ui_ops = NULL;
@@ -73,7 +75,7 @@
 	if (on && !gc->keepalive)
 	{
 		purple_debug_info("connection", "Activating keepalive.\n");
-		gc->keepalive = purple_timeout_add_seconds(30, send_keepalive, gc);
+		gc->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc);
 	}
 	else if (!on && gc->keepalive > 0)
 	{
--- a/libpurple/prpl.h	Mon Dec 03 16:38:38 2007 +0000
+++ b/libpurple/prpl.h	Mon Dec 03 19:02:28 2007 +0000
@@ -292,6 +292,13 @@
 	void (*chat_whisper)(PurpleConnection *, int id,
 						 const char *who, const char *message);
 	int  (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags);
+
+	/** If implemented, this will be called regularly for this prpl's
+	 *  active connections.  You'd want to do this if you need to repeatedly
+	 *  send some kind of keepalive packet to the server to avoid being
+	 *  disconnected.  ("Regularly" is defined by
+	 *  <code>KEEPALIVE_INTERVAL</code> in <tt>libpurple/connection.c</tt>.)
+	 */
 	void (*keepalive)(PurpleConnection *);
 
 	/** new user registration */