im.pidgin.pidgin: 3fe65eb2edfee15615ff166f23974cfe540d6b66

resiak at soc.pidgin.im resiak at soc.pidgin.im
Mon Dec 3 14:05:50 EST 2007


-----------------------------------------------------------------
Revision: 3fe65eb2edfee15615ff166f23974cfe540d6b66
Ancestor: 7ee7b2b21b87af37309e5a92abe0c9f4f8b1e122
Author: resiak at soc.pidgin.im
Date: 2007-12-03T19:02:28
Branch: im.pidgin.pidgin

Modified files:
        libpurple/connection.c libpurple/prpl.h

ChangeLog: 

De-magic number the prpl_info->keepalive interval, and document it.

-------------- next part --------------
============================================================
--- libpurple/connection.c	6f67862ae0e5c8427066c993b09e7a33c40e26d0
+++ libpurple/connection.c	150dc58137978d835511891eeedc081cba3bbc7d
@@ -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 @@ update_keepalive(PurpleConnection *gc, g
 	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)
 	{
============================================================
--- libpurple/prpl.h	40b815bc15710df99615026ff15f14124c7f6e5a
+++ libpurple/prpl.h	bc8a3086acdf183f2730e972e0499ddcb00d220c
@@ -292,6 +292,13 @@ struct _PurplePluginProtocolInfo
 	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 */


More information about the Commits mailing list