gobjectification: e1656d99: prpls use purple_connection_received_now...

sadrul at pidgin.im sadrul at pidgin.im
Thu Mar 13 05:55:50 EDT 2008


-----------------------------------------------------------------
Revision: e1656d9913e6a6c5e05b38be3767826483ee1dc7
Ancestor: 91198a44e930739d740ed2806c03f8764f8d1e88
Author: sadrul at pidgin.im
Date: 2008-03-13T09:18:34
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/e1656d9913e6a6c5e05b38be3767826483ee1dc7

Modified files:
        libpurple/connection.c libpurple/connection.h
        libpurple/protocols/gg/gg.c libpurple/protocols/irc/irc.c
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/msn/servconn.c
        libpurple/protocols/msnp9/servconn.c
        libpurple/protocols/oscar/flap_connection.c
        libpurple/protocols/simple/simple.c
        libpurple/protocols/toc/toc.c
        libpurple/protocols/yahoo/yahoo.c

ChangeLog: 

prpls use purple_connection_received_now instead of gc->last_received to keep track of the time of the last received data. Feel free to change to a better named function.

-------------- next part --------------
============================================================
--- libpurple/connection.c	51ca209b8556e7d3594ceb72f6247b834c0be61c
+++ libpurple/connection.c	d1b2dfe99b78d57149c667a4a4e2a7b4baf591a8
@@ -562,6 +562,12 @@ void
 }
 
 void
+purple_connection_received_now(PurpleConnection *conn)
+{
+    conn->priv->last_received = time(NULL);
+}
+
+void
 purple_connection_notice(PurpleConnection *gc, const char *text)
 {
 	PurpleConnectionUiOps *ops;
============================================================
--- libpurple/connection.h	c36e99ce115186baa36dc5fa031d7195af8c1f04
+++ libpurple/connection.h	100f3e63f17e182b1198cb87afae1bced312a115
@@ -433,6 +433,14 @@ void purple_connection_update_progress(P
 									 size_t step, size_t count);
 
 /**
+ * Notify the connection that it has received data from the server.
+ * Should be called by the protocol plugins only.
+ *
+ * @param conn  The connection.
+ */
+void purple_connection_received_now(PurpleConnection *conn);
+
+/**
  * Displays a connection-specific notice.
  *
  * @param gc   The connection.
============================================================
--- libpurple/protocols/gg/gg.c	e4d0dcb87774c453830fc877ceeb7b74aa24a577
+++ libpurple/protocols/gg/gg.c	a55ce0f7394a85f5dd6e8f568f20c1cf91c507d3
@@ -1314,10 +1314,7 @@ static void ggp_callback_recv(gpointer _
 			_("Unable to read socket"));
 		return;
 	}
-#warning FIXME: uncomment!!
-#if 0
-	gc->last_received = time(NULL);
-#endif
+	purple_connection_received_now(gc);
 	switch (ev->type) {
 		case GG_EVENT_NONE:
 			/* Nothing happened. */
============================================================
--- libpurple/protocols/irc/irc.c	7ddad31cbcf27cbfe6f0e3861c7cbe96d8fd2912
+++ libpurple/protocols/irc/irc.c	8f137b0705f75f2a5ff6e107d0cb3998e377a444
@@ -573,10 +573,7 @@ static void read_input(struct irc_conn *
 {
 	char *cur, *end;
 
-#warning FIXME: uncomment!!
-#if 0
-	purple_account_get_connection(irc->account)->last_received = time(NULL);
-#endif
+	purple_connection_received_now(purple_account_get_connection(irc->account));
 	irc->inbufused += len;
 	irc->inbuf[irc->inbufused] = '\0';
 
============================================================
--- libpurple/protocols/jabber/jabber.c	4a651e21bc6ab544ec9ed0d74cc50dad5aaa9975
+++ libpurple/protocols/jabber/jabber.c	9fd6cbcdb47a35ae14b7c10e28cc7053d9432c0d
@@ -432,10 +432,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
 	}
 
 	while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) {
-#warning FIXME: uncomment!
-#if 0
-		gc->last_received = time(NULL);
-#endif
+		purple_connection_received_now(gc);
 		buf[len] = '\0';
 		purple_debug(PURPLE_DEBUG_INFO, "jabber", "Recv (ssl)(%d): %s\n", len, buf);
 		jabber_parser_process(js, buf, len);
@@ -463,10 +460,7 @@ jabber_recv_cb(gpointer data, gint sourc
 		return;
 
 	if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
-#warning FIXME: uncomment!
-#if 0
-		gc->last_received = time(NULL);
-#endif
+		purple_connection_received_now(gc);
 #ifdef HAVE_CYRUS_SASL
 		if (js->sasl_maxbuf>0) {
 			const char *out;
============================================================
--- libpurple/protocols/msn/servconn.c	f66752b87c8222a84ed75a9b0615a3473f3ecfb6
+++ libpurple/protocols/msn/servconn.c	6fba2e0976344ed413a640444a8dbe598d5fb42f
@@ -391,10 +391,7 @@ read_cb(gpointer data, gint source, Purp
 	session = servconn->session;
 
 	len = read(servconn->fd, buf, sizeof(buf) - 1);
-#warning FIXME: uncomment!!
-#if 0
-	purple_account_get_connection(servconn->session->account)->last_received = time(NULL);
-#endif
+	purple_connection_received_now(purple_account_get_connection(servconn->session->account));
 
 	if (len <= 0) {
 		switch (errno) {
============================================================
--- libpurple/protocols/msnp9/servconn.c	8fdb48f52d23a17e27acad6dbb8c8f7385b23877
+++ libpurple/protocols/msnp9/servconn.c	b6e99e5e28b0e6e5b1b6e3b0d8b8a25636b29f42
@@ -387,10 +387,7 @@ read_cb(gpointer data, gint source, Purp
 	session = servconn->session;
 
 	len = read(servconn->fd, buf, sizeof(buf) - 1);
-#warning FIXME: uncomment!!
-#if 0
-	purple_account_get_connection(servconn->session->account)->last_received = time(NULL);
-#endif
+	purple_connection_received_now(purple_account_get_connection(servconn->session->account));
 
 	if (len < 0 && errno == EAGAIN)
 		return;
============================================================
--- libpurple/protocols/oscar/flap_connection.c	b81e96563447ba6c04a675cdf3667689146ac341
+++ libpurple/protocols/oscar/flap_connection.c	8c21aeecdc7d4e09850670053ae55e4cf2e2c236
@@ -817,10 +817,7 @@ flap_connection_recv_cb(gpointer data, g
 						OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno));
 				break;
 			}
-#warning FIXME: uncomment!!
-#if 0
-			conn->od->gc->last_received = time(NULL);
-#endif
+			purple_connection_received_now(conn->od->gc);
 
 			/* If we don't even have a complete FLAP header then do nothing */
 			conn->header_received += read;
============================================================
--- libpurple/protocols/simple/simple.c	cf4bd2f154ee1b9d51518bdaf3c96ef9f77c12c6
+++ libpurple/protocols/simple/simple.c	3fb795d012615f6cbe3649a630e515bfc44d8b5c
@@ -1675,10 +1675,7 @@ static void simple_input_cb(gpointer dat
 		if(sip->fd == source) sip->fd = -1;
 		return;
 	}
-#warning FIXME: uncomment!
-#if 0
-	gc->last_received = time(NULL);
-#endif
+	purple_connection_received_now(gc);
 	conn->inbufused += len;
 	conn->inbuf[conn->inbufused] = '\0';
 
============================================================
--- libpurple/protocols/toc/toc.c	c6ac27281a1f7496979f5eb164c7be49fe977578
+++ libpurple/protocols/toc/toc.c	876201cfda88eb504467b90bceb2bfbc3eafd408
@@ -132,7 +132,7 @@ static void toc_login(PurpleAccount *acc
 	char buf[80];
 
 	gc = purple_account_get_connection(account);
-	gc->proto_data = tdt = g_new0(struct toc_data, 1);
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc),tdt = g_new0(struct toc_data, 1));
 	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
 	gc->flags |= PURPLE_CONNECTION_FLAGS_AUTO_RESP;
 
@@ -166,7 +166,7 @@ static void toc_login_callback(gpointer 
 		return;
 	}
 
-	tdt = gc->proto_data;
+	tdt = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (source == -1) {
 		/* we didn't successfully connect. tdt->toc_fd is valid here */
@@ -207,8 +207,8 @@ static void toc_close(PurpleConnection *
 	if (gc->inpa > 0)
 		purple_input_remove(gc->inpa);
 	gc->inpa = 0;
-	close(((struct toc_data *)gc->proto_data)->toc_fd);
-	g_free(gc->proto_data);
+	close(((struct toc_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc)))->toc_fd);
+	g_free(purple_object_get_protocol_data(PURPLE_OBJECT(gc)));
 }
 
 static void toc_build_config(PurpleAccount *account, char *s, int len, gboolean show)
@@ -355,7 +355,7 @@ static int sflap_send(PurpleConnection *
 
 static int sflap_send(PurpleConnection *gc, const char *buf, int olen, int type)
 {
-	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
+	struct toc_data *tdt = (struct toc_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	int len;
 	int slen = 0;
 	int ret;
@@ -421,7 +421,7 @@ static int wait_reply(PurpleConnection *
 
 static int wait_reply(PurpleConnection *gc, char *buffer, size_t buflen)
 {
-	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
+	struct toc_data *tdt = (struct toc_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	struct sflap_hdr *hdr;
 	int ret;
 
@@ -660,7 +660,7 @@ static void toc_callback(gpointer data, 
 {
 	PurpleConnection *gc = (PurpleConnection *)data;
 	PurpleAccount *account = purple_connection_get_account(gc);
-	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
+	struct toc_data *tdt = (struct toc_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	struct sflap_hdr *hdr;
 	struct signon so;
 	char buf[8 * 1024], *c;
============================================================
--- libpurple/protocols/yahoo/yahoo.c	a5ac479db61fcbdcef8d39a8aaecfc343974d057
+++ libpurple/protocols/yahoo/yahoo.c	5b2c8266498ab08420ce398960e4e44f8ba8d526
@@ -2498,10 +2498,7 @@ static void yahoo_pending(gpointer data,
 				_("Server closed the connection."));
 		return;
 	}
-#warning FIXME: uncomment!!
-#if 0
-	gc->last_received = time(NULL);
-#endif
+	purple_connection_received_now(gc);
 	yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
 	memcpy(yd->rxqueue + yd->rxlen, buf, len);
 	yd->rxlen += len;


More information about the Commits mailing list