From bcbe42dd7a4b7bca0e699c3e52f2c9bf7b37deba Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 8 May 2016 21:51:38 +0200 Subject: Introduce and use fe_timeout_add_seconds This should allow the operating system to be a bit more lax about timeouts, allowing more efficient power management. --- src/common/dcc.c | 2 +- src/common/fe.h | 1 + src/common/hexchat.c | 8 ++++---- src/common/ignore.c | 2 +- src/common/inbound.c | 2 +- src/common/server.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/common') diff --git a/src/common/dcc.c b/src/common/dcc.c index d288556e..02cbeb00 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -2234,7 +2234,7 @@ new_dcc (void) dcc_list = g_slist_prepend (dcc_list, dcc); if (timeout_timer == 0) { - timeout_timer = fe_timeout_add (1000, dcc_check_timeouts, NULL); + timeout_timer = fe_timeout_add_seconds (1, dcc_check_timeouts, NULL); } return dcc; } diff --git a/src/common/fe.h b/src/common/fe.h index 209abb00..a748668b 100644 --- a/src/common/fe.h +++ b/src/common/fe.h @@ -50,6 +50,7 @@ void fe_main (void); void fe_cleanup (void); void fe_exit (void); int fe_timeout_add (int interval, void *callback, void *userdata); +int fe_timeout_add_seconds (int interval, void *callback, void *userdata); void fe_timeout_remove (int tag); void fe_new_window (struct session *sess, int focus); void fe_new_server (struct server *serv); diff --git a/src/common/hexchat.c b/src/common/hexchat.c index 1f61f84f..f2c79024 100644 --- a/src/common/hexchat.c +++ b/src/common/hexchat.c @@ -395,14 +395,14 @@ irc_init (session *sess) #endif if (prefs.hex_notify_timeout) - notify_tag = fe_timeout_add (prefs.hex_notify_timeout * 1000, - notify_checklist, NULL); + notify_tag = fe_timeout_add_seconds (prefs.hex_notify_timeout, + notify_checklist, NULL); - fe_timeout_add (prefs.hex_away_timeout * 1000, away_check, NULL); + fe_timeout_add_seconds (prefs.hex_away_timeout, away_check, NULL); if (prefs.hex_gui_lagometer) { fe_timeout_add (500, hexchat_lag_check_update, NULL); - fe_timeout_add (30000, hexchat_lag_check, NULL); + fe_timeout_add_seconds (30, hexchat_lag_check, NULL); } if (arg_url != NULL) diff --git a/src/common/ignore.c b/src/common/ignore.c index 6085b657..1d1eaf20 100644 --- a/src/common/ignore.c +++ b/src/common/ignore.c @@ -410,7 +410,7 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct { prefs.hex_gui_autoopen_dialog = 0; /* turn it back on in 30 secs */ - fe_timeout_add (30000, flood_autodialog_timeout, NULL); + fe_timeout_add_seconds (30, flood_autodialog_timeout, NULL); } return 0; } diff --git a/src/common/inbound.c b/src/common/inbound.c index 0e962caf..ffc8a3e7 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1594,7 +1594,7 @@ inbound_login_end (session *sess, char *text, const message_tags_data *tags_data && ((((ircnet *)serv->network)->pass && inbound_nickserv_login (serv)) || ((ircnet *)serv->network)->commandlist)) { - serv->joindelay_tag = fe_timeout_add (prefs.hex_irc_join_delay * 1000, check_autojoin_channels, serv); + serv->joindelay_tag = fe_timeout_add_seconds (prefs.hex_irc_join_delay, check_autojoin_channels, serv); } else { diff --git a/src/common/server.c b/src/common/server.c index 665c913c..83e3ba9a 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -249,7 +249,7 @@ static void close_socket (int sok) { /* close the socket in 5 seconds so the QUIT message is not lost */ - fe_timeout_add (5000, close_socket_cb, GINT_TO_POINTER (sok)); + fe_timeout_add_seconds (5, close_socket_cb, GINT_TO_POINTER (sok)); } /* handle 1 line of text received from the server */ -- cgit 1.4.1