# HG changeset patch # User Will Thompson # Date 1196708548 0 # Node ID fb8ab2490ac406941f67918cef0205f195f2c3de # Parent d376b1e191b5f29a55550dd7bdab1647a096281c De-magic number the prpl_info->keepalive interval, and document it. diff -r d376b1e191b5 -r fb8ab2490ac4 libpurple/connection.c --- 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) { diff -r d376b1e191b5 -r fb8ab2490ac4 libpurple/prpl.h --- 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 + * KEEPALIVE_INTERVAL in libpurple/connection.c.) + */ void (*keepalive)(PurpleConnection *); /** new user registration */