pidgin: 426940a0: Add a purple_connection_update_last_rece...

andrew.victor at mxit.com andrew.victor at mxit.com
Tue Oct 18 17:57:01 EDT 2011


----------------------------------------------------------------------
Revision: 426940a0e723b61c64df76ed1c69f32a4b2c5864
Parent:   b8202627a0a57b35822ed4f574e6a52ca06fab7e
Author:   andrew.victor at mxit.com
Date:     10/18/11 16:25:41
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/426940a0e723b61c64df76ed1c69f32a4b2c5864

Changelog: 

Add a purple_connection_update_last_received() function to update the
 PurpleConnection->last_received value.


Changes against parent b8202627a0a57b35822ed4f574e6a52ca06fab7e

  patched  ChangeLog.API
  patched  libpurple/connection.c
  patched  libpurple/connection.h
  patched  libpurple/protocols/irc/irc.c
  patched  libpurple/protocols/jabber/jabber.c
  patched  libpurple/protocols/msn/httpconn.c
  patched  libpurple/protocols/msn/servconn.c
  patched  libpurple/protocols/oscar/flap_connection.c
  patched  libpurple/protocols/simple/simple.c
  patched  libpurple/protocols/yahoo/libymsg.c

-------------- next part --------------
============================================================
--- libpurple/protocols/irc/irc.c	3545e4e803ceaa2bde96ccd9fbcefaaaba93be73
+++ libpurple/protocols/irc/irc.c	c9585f7a660fa47cf51126640683b74d5ee64413
@@ -648,7 +648,7 @@ static void read_input(struct irc_conn *
 	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';
 
============================================================
--- libpurple/protocols/jabber/jabber.c	0cad5485dad50fd34e38220736f305880dcb931a
+++ libpurple/protocols/jabber/jabber.c	33afa6391b6eec4988130f0ccbce7a283972d64b
@@ -653,7 +653,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
 	}
 
 	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 @@ jabber_recv_cb(gpointer data, gint sourc
 	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;
============================================================
--- libpurple/protocols/yahoo/libymsg.c	33181fd2401298245203cfdb5ad10cb6e75cdc67
+++ libpurple/protocols/yahoo/libymsg.c	4d9cf41e9410969a1f3e13952166d8459b9b314b
@@ -3155,7 +3155,7 @@ static void yahoo_pending(gpointer data,
 				_("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;
============================================================
--- libpurple/protocols/msn/servconn.c	9cd871a8ae4566771f95a9d281edfeb2be16a1bf
+++ libpurple/protocols/msn/servconn.c	624edc2481c2067e1485e69aed41cc73b465aac5
@@ -423,7 +423,7 @@ read_cb(gpointer data, gint source, Purp
 
 	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);
============================================================
--- libpurple/connection.c	a7cdbd077499a0917819ef86c1417dc0bf6aa92c
+++ libpurple/connection.c	a59139c405b8ced03d0e396d2320c5676bdce9b4
@@ -627,6 +627,13 @@ purple_connection_error_is_fatal (Purple
 	}
 }
 
+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)
 {
============================================================
--- libpurple/connection.h	0ca3c3cca09faf13661b2c2f2b4996f418cd353c
+++ libpurple/connection.h	d10f6b27a87b234ebd2aede96e4ff5ac7d0b62ab
@@ -447,6 +447,14 @@ purple_connection_error_is_fatal (Purple
 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);
+
 /*@}*/
 
 /**************************************************************************/
============================================================
--- ChangeLog.API	3a8646ece102ff70172e3185f85d4f8a844a79d9
+++ ChangeLog.API	61bcac61d720632bf1d8e12a569c748335d7994d
@@ -13,6 +13,7 @@ version 3.0.0 (??/??/????):
 		* 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
============================================================
--- libpurple/protocols/msn/httpconn.c	26c3ed7cbb5326a30364bcce7a85690cecbf7cd7
+++ libpurple/protocols/msn/httpconn.c	5268bda268a2dba1c2296988c73f330485639fec
@@ -287,7 +287,7 @@ read_cb(gpointer data, gint source, Purp
 
 	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);
============================================================
--- libpurple/protocols/simple/simple.c	989eaa58120255ad49c2dbd8f543e83d6f2050e0
+++ libpurple/protocols/simple/simple.c	63bdc5aa575fcca526458dffc8d0f3e5f46e706c
@@ -1705,7 +1705,7 @@ static void simple_input_cb(gpointer dat
 		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';
 
============================================================
--- libpurple/protocols/oscar/flap_connection.c	faceb88102b041b253e299c46dd31331da868003
+++ libpurple/protocols/oscar/flap_connection.c	c972147709ca16ba1b2dee28519c369b62f1a751
@@ -921,7 +921,7 @@ flap_connection_recv(FlapConnection *con
 						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;


More information about the Commits mailing list