Mon, 03 Dec 2007 19:02:28 +0000
De-magic number the prpl_info->keepalive interval, and document it.
| libpurple/connection.c | file | annotate | diff | comparison | revisions | |
| libpurple/prpl.h | file | annotate | diff | comparison | revisions |
--- 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 */