pidgin: fe4f5d91: A patch from Arunan Balasubramaniam to u...

qulogic at pidgin.im qulogic at pidgin.im
Fri Apr 10 03:36:14 EDT 2009


-----------------------------------------------------------------
Revision: fe4f5d91d1605cf93c53470e59d4bf8da6c5c840
Ancestor: a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Author: foss at abala.me
Date: 2009-04-10T06:18:08
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fe4f5d91d1605cf93c53470e59d4bf8da6c5c840

Modified files:
        libpurple/conversation.c libpurple/plugins/filectl.c
        libpurple/plugins/joinpart.c libpurple/protocols/irc/msgs.c
        libpurple/protocols/jabber/buddy.c
        libpurple/protocols/msnp9/httpconn.c
        libpurple/protocols/msnp9/slp.c
        libpurple/protocols/msnp9/slpcall.c
        libpurple/protocols/msnp9/slpcall.h
        libpurple/protocols/msnp9/transaction.c
        libpurple/protocols/myspace/myspace.c
        libpurple/protocols/myspace/myspace.h
        libpurple/protocols/oscar/oscar.c
        libpurple/protocols/oscar/peer.c
        libpurple/protocols/sametime/sametime.c
        libpurple/protocols/zephyr/zephyr.c

ChangeLog: 

A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
milliseconds in libpurple. This enables grouping of timers for greater
power efficiency.

Fixes #8875.

-------------- next part --------------
============================================================
--- libpurple/conversation.c	73d3d0a936e4d7ecaf9e4213ca4798cf18c663d5
+++ libpurple/conversation.c	cebfa6db6b215217da2385790766b7bb082e65b4
@@ -33,7 +33,7 @@
 #include "signals.h"
 #include "util.h"
 
-#define SEND_TYPED_TIMEOUT 5000
+#define SEND_TYPED_TIMEOUT_SECONDS 5
 
 static GList *conversations = NULL;
 static GList *ims = NULL;
@@ -1122,8 +1122,9 @@ purple_conv_im_start_send_typed_timeout(
 {
 	g_return_if_fail(im != NULL);
 
-	im->send_typed_timeout = purple_timeout_add(SEND_TYPED_TIMEOUT, send_typed_cb,
-											  purple_conv_im_get_conversation(im));
+	im->send_typed_timeout = purple_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS,
+	                                                    send_typed_cb,
+	                                                    purple_conv_im_get_conversation(im));
 }
 
 void
============================================================
--- libpurple/plugins/filectl.c	3663c344f6e2a9882fa17ee77fafeba92e9a4a20
+++ libpurple/plugins/filectl.c	23d49eb815d2987ec8ee8a32ece78be92a658291
@@ -220,7 +220,7 @@ plugin_load(PurplePlugin *plugin)
 plugin_load(PurplePlugin *plugin)
 {
 	init_file();
-	check = purple_timeout_add(5000, (GSourceFunc)check_file, NULL);
+	check = purple_timeout_add_seconds(5, (GSourceFunc)check_file, NULL);
 
 	return TRUE;
 }
============================================================
--- libpurple/plugins/joinpart.c	05c0e5ac8afef64171d2e1d44994fdec1914374e
+++ libpurple/plugins/joinpart.c	7c12cdc82b738b03dcd501505bfd302e0bce8595
@@ -194,7 +194,7 @@ static gboolean plugin_load(PurplePlugin
 	                    PURPLE_CALLBACK(received_chat_msg_cb), users);
 
 	/* Cleanup every 5 minutes */
-	id = purple_timeout_add(1000 * 60 * 5, (GSourceFunc)clean_users_hash, users);
+	id = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, users);
 
 	data = g_new(gpointer, 2);
 	data[0] = users;
============================================================
--- libpurple/protocols/irc/msgs.c	02197c6d9614868ec489bd42af5cf22bda507f5f
+++ libpurple/protocols/irc/msgs.c	d2ef7d6ec4d533fa954a4f91eaa7f8dedb5728db
@@ -128,7 +128,7 @@ static void irc_connected(struct irc_con
 
 	irc_blist_timeout(irc);
 	if (!irc->timer)
-		irc->timer = purple_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc);
+		irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc);
 }
 
 void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args)
============================================================
--- libpurple/protocols/jabber/buddy.c	ba72c7e9810ae0c2880654f87cf95a363b1e7d66
+++ libpurple/protocols/jabber/buddy.c	62f03dd797303c511a1ffebe46b41c4baac26539
@@ -1866,7 +1866,7 @@ static void jabber_buddy_get_info_for_ji
 	}
 
 	js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi);
-	jbi->timeout_handle = purple_timeout_add(30000, jabber_buddy_get_info_timeout, jbi);
+	jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi);
 }
 
 void jabber_buddy_get_info(PurpleConnection *gc, const char *who)
============================================================
--- libpurple/protocols/msnp9/httpconn.c	31e00e6a8b2e1e4f1742af9e8ca6a5e5ea9abb22
+++ libpurple/protocols/msnp9/httpconn.c	5948049699e1b38cb71db67e07dea25423e7addb
@@ -703,7 +703,7 @@ connect_cb(gpointer data, gint source, c
 		httpconn->inpa = purple_input_add(httpconn->fd, PURPLE_INPUT_READ,
 			read_cb, data);
 
-		httpconn->timer = purple_timeout_add(2000, msn_httpconn_poll, httpconn);
+		httpconn->timer = purple_timeout_add_seconds(3, msn_httpconn_poll, httpconn);
 
 		msn_httpconn_process_queue(httpconn);
 	}
============================================================
--- libpurple/protocols/msnp9/slp.c	7cbd74e1d1abfe2207c5211295b4c9a9318f4ae2
+++ libpurple/protocols/msnp9/slp.c	d9f32cedcbd873f775170b0d41200b327d359473
@@ -33,8 +33,8 @@
 
 #include "smiley.h"
 
-/* ms to delay between sending buddy icon requests to the server. */
-#define BUDDY_ICON_DELAY 20000
+/* Seconds to delay between sending buddy icon requests to the server. */
+#define BUDDY_ICON_DELAY 20
 
 static void send_ok(MsnSlpCall *slpcall, const char *branch,
 					const char *type, const char *content);
@@ -1058,8 +1058,8 @@ end_user_display(MsnSlpCall *slpcall, Ms
 		purple_timeout_remove(userlist->buddy_icon_request_timer);
 	}
 
-	/* Wait BUDDY_ICON_DELAY ms before freeing our window slot and requesting the next icon. */
-	userlist->buddy_icon_request_timer = purple_timeout_add(BUDDY_ICON_DELAY, 
+	/* Wait BUDDY_ICON_DELAY_S seconds before freeing our window slot and requesting the next icon. */
+	userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, 
 														  msn_release_buddy_icon_request_timeout, userlist);
 }
 
============================================================
--- libpurple/protocols/msnp9/slpcall.c	700df0e754c850a4578a6f62dabe91b07a4bc9d9
+++ libpurple/protocols/msnp9/slpcall.c	ef0face7ccf8153e3a58bda356cebbc87645a0b0
@@ -68,7 +68,7 @@ msn_slp_call_new(MsnSlpLink *slplink)
 
 	msn_slplink_add_slpcall(slplink, slpcall);
 
-	slpcall->timer = purple_timeout_add(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall);
+	slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall);
 
 	return slpcall;
 }
============================================================
--- libpurple/protocols/msnp9/slpcall.h	a142eff835ceceff7c3c5136d36ad85503d744ec
+++ libpurple/protocols/msnp9/slpcall.h	8213f49f7c6fba6207109dd7a266be884417b234
@@ -33,7 +33,7 @@ typedef struct _MsnSlpCall MsnSlpCall;
 #include "slpsession.h"
 
 /* The official client seems to timeout slp calls after 5 minutes */
-#define MSN_SLPCALL_TIMEOUT 300000
+#define MSN_SLPCALL_TIMEOUT 300
 
 typedef enum
 {
============================================================
--- libpurple/protocols/msnp9/transaction.c	499cec7eb2dcb61d2f2b16270fb92a449e67bde5
+++ libpurple/protocols/msnp9/transaction.c	32ca29afe98b81dafddf3cc5e1df68737b004ee0
@@ -211,7 +211,7 @@ msn_transaction_set_timeout_cb(MsnTransa
 		purple_timeout_remove(trans->timer);
 	}
 	trans->timeout_cb = cb;
-	trans->timer = purple_timeout_add(60000, transaction_timeout, trans);
+	trans->timer = purple_timeout_add_seconds(60, transaction_timeout, trans);
 }
 
 void
============================================================
--- libpurple/protocols/myspace/myspace.c	1e0624d9f7a52b6f6cae3f6022b108dea31c676e
+++ libpurple/protocols/myspace/myspace.c	7e742b67d053a10d627af7d18b87b0a57887812c
@@ -1245,7 +1245,7 @@ gboolean msim_we_are_logged_on(MsimSessi
 
 	/* Disable due to problems with timeouts. TODO: fix. */
 #ifdef MSIM_USE_KEEPALIVE
-	purple_timeout_add(MSIM_KEEPALIVE_INTERVAL_CHECK,
+	purple_timeout_add_seconds(MSIM_KEEPALIVE_INTERVAL_CHECK,
 			(GSourceFunc)msim_check_alive, session);
 #endif
 
============================================================
--- libpurple/protocols/myspace/myspace.h	578f4250226fe37a0fcc8f5efea159be88658e8e
+++ libpurple/protocols/myspace/myspace.h	e294fc90345e61c08b02436888b9907794cc0605
@@ -114,8 +114,8 @@
 #define MSIM_KEEPALIVE_INTERVAL     (3 * 60)
 /*#define MSIM_USE_KEEPALIVE*/
 
-/* Time to check if alive (milliseconds) */
-#define MSIM_KEEPALIVE_INTERVAL_CHECK   (30 * 1000)
+/* Time to check if alive (seconds) */
+#define MSIM_KEEPALIVE_INTERVAL_CHECK   30
 
 /* Time to check for new mail (milliseconds) */
 #define MSIM_MAIL_INTERVAL_CHECK    (60 * 1000)
============================================================
--- libpurple/protocols/oscar/oscar.c	74d777b24abab62b64f589d9d30dcdc79f354406
+++ libpurple/protocols/oscar/oscar.c	e3417606a52adddf004513f448a98fba1a2823f0
@@ -1268,7 +1268,7 @@ flap_connection_established_bos(OscarDat
 	aim_ssi_reqdata(od);
 	if (od->getblisttimer > 0)
 		purple_timeout_remove(od->getblisttimer);
-	od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od);
+	od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od);
 
 	aim_locate_reqrights(od);
 	aim_buddylist_reqrights(od, conn);
@@ -5047,7 +5047,7 @@ static int purple_ssi_parseerr(OscarData
 					_("The AIM servers were temporarily unable to send "
 					"your buddy list.  Your buddy list is not lost, and "
 					"will probably become available in a few minutes."));
-		od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od);
+		od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od);
 		return 1;
 	}
 
============================================================
--- libpurple/protocols/oscar/peer.c	4b8e5495205fd1fc286692921afc2fda48a526a4
+++ libpurple/protocols/oscar/peer.c	fcca028aba9daf06552732aaf4fc1760fecd3f78
@@ -812,7 +812,7 @@ peer_connection_trynext(PeerConnection *
 			(conn->client_connect_data != NULL))
 		{
 			/* Connecting... */
-			conn->connect_timeout_timer = purple_timeout_add(5000,
+			conn->connect_timeout_timer = purple_timeout_add_seconds(5,
 					peer_connection_tooktoolong, conn);
 			return;
 		}
============================================================
--- libpurple/protocols/sametime/sametime.c	9f68a7c9642ad3fa15db782d9c9fab24b9dcdb71
+++ libpurple/protocols/sametime/sametime.c	5b8f7675a9d9740dd28f098fbfb49ac78a9c1c6a
@@ -808,7 +808,7 @@ static void blist_schedule(struct mwPurp
 static void blist_schedule(struct mwPurplePluginData *pd) {
   if(pd->save_event) return;
 
-  pd->save_event = purple_timeout_add(BLIST_SAVE_SECONDS * 1000,
+  pd->save_event = purple_timeout_add_seconds(BLIST_SAVE_SECONDS,
 				    blist_save_cb, pd);
 }
 
============================================================
--- libpurple/protocols/zephyr/zephyr.c	42e03c39d34ee66dc0b2f9c072b0fac1e4e94130
+++ libpurple/protocols/zephyr/zephyr.c	17fe34c8f7d39f913d89d48fe11b6ecde7dd8fe8
@@ -1880,7 +1880,7 @@ static void zephyr_login(PurpleAccount *
 	} else if (use_tzc(zephyr)) {
 		zephyr->nottimer = purple_timeout_add(100, check_notify_tzc, gc);
 	} 
-	zephyr->loctimer = purple_timeout_add(20000, check_loc, gc); 
+	zephyr->loctimer = purple_timeout_add_seconds(20, check_loc, gc); 
 
 }
 


More information about the Commits mailing list