Mercurial > pidgin
changeset 32306:50cd80d3554e
Add a purple_connection_update_last_received() function to update the
PurpleConnection->last_received value.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 18 Oct 2011 20:25:41 +0000 |
parents | 2ec94166be43 |
children | d8c652ea476a |
files | ChangeLog.API libpurple/connection.c libpurple/connection.h libpurple/protocols/irc/irc.c libpurple/protocols/jabber/jabber.c libpurple/protocols/msn/httpconn.c libpurple/protocols/msn/servconn.c libpurple/protocols/oscar/flap_connection.c libpurple/protocols/simple/simple.c libpurple/protocols/yahoo/libymsg.c |
diffstat | 10 files changed, 24 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog.API Tue Oct 18 18:47:48 2011 +0000 +++ b/ChangeLog.API Tue Oct 18 20:25:41 2011 +0000 @@ -13,6 +13,7 @@ * purple_conv_chat_cb_set_ui_data * purple_connection_get_flags * purple_connection_set_flags + * purple_connection_update_last_received * purple_conversation_get_ui_data * purple_conversation_set_ui_data * purple_notify_searchresult_column_is_visible
--- a/libpurple/connection.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/connection.c Tue Oct 18 20:25:41 2011 +0000 @@ -627,6 +627,13 @@ } } +void purple_connection_update_last_received(PurpleConnection *gc) +{ + g_return_if_fail(gc != NULL); + + gc->last_received = time(NULL); +} + void purple_connections_disconnect_all(void) {
--- a/libpurple/connection.h Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/connection.h Tue Oct 18 20:25:41 2011 +0000 @@ -447,6 +447,14 @@ gboolean purple_connection_error_is_fatal (PurpleConnectionError reason); +/** + * Indicate that a packet was received on the connection. + * Set by the prpl to avoid sending unneeded keepalives. + * + * @param gc The connection. + */ +void purple_connection_update_last_received(PurpleConnection *gc); + /*@}*/ /**************************************************************************/
--- a/libpurple/protocols/irc/irc.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/irc/irc.c Tue Oct 18 20:25:41 2011 +0000 @@ -648,7 +648,7 @@ PurpleConnection *connection = purple_account_get_connection(irc->account); char *cur, *end; - connection->last_received = time(NULL); + purple_connection_update_last_received(connection); irc->inbufused += len; irc->inbuf[irc->inbufused] = '\0';
--- a/libpurple/protocols/jabber/jabber.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Oct 18 20:25:41 2011 +0000 @@ -653,7 +653,7 @@ } while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); buf[len] = '\0'; purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); jabber_parser_process(js, buf, len); @@ -687,7 +687,7 @@ g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); #ifdef HAVE_CYRUS_SASL if (js->sasl_maxbuf > 0) { const char *out;
--- a/libpurple/protocols/msn/httpconn.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/msn/httpconn.c Tue Oct 18 20:25:41 2011 +0000 @@ -287,7 +287,7 @@ if (servconn->type == MSN_SERVCONN_NS) { PurpleConnection *gc = purple_account_get_connection(servconn->session->account); - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); } len = read(httpconn->fd, buf, sizeof(buf) - 1);
--- a/libpurple/protocols/msn/servconn.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/msn/servconn.c Tue Oct 18 20:25:41 2011 +0000 @@ -423,7 +423,7 @@ if (servconn->type == MSN_SERVCONN_NS) { PurpleConnection *gc = purple_account_get_connection(servconn->session->account); - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); } len = read(servconn->fd, buf, sizeof(buf) - 1);
--- a/libpurple/protocols/oscar/flap_connection.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Tue Oct 18 20:25:41 2011 +0000 @@ -921,7 +921,7 @@ OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); break; } - conn->od->gc->last_received = time(NULL); + purple_connection_update_last_received(conn->od->gc); /* If we don't even have a complete FLAP header then do nothing */ conn->header_received += read;
--- a/libpurple/protocols/simple/simple.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/simple/simple.c Tue Oct 18 20:25:41 2011 +0000 @@ -1705,7 +1705,7 @@ if(sip->fd == source) sip->fd = -1; return; } - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); conn->inbufused += len; conn->inbuf[conn->inbufused] = '\0';
--- a/libpurple/protocols/yahoo/libymsg.c Tue Oct 18 18:47:48 2011 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Tue Oct 18 20:25:41 2011 +0000 @@ -3155,7 +3155,7 @@ _("Server closed the connection")); return; } - gc->last_received = time(NULL); + purple_connection_update_last_received(gc); yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); memcpy(yd->rxqueue + yd->rxlen, buf, len); yd->rxlen += len;