summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-05-08 21:51:38 +0200
committerPatrick Griffis <tingping@tingping.se>2016-06-29 15:42:11 -0400
commitbcbe42dd7a4b7bca0e699c3e52f2c9bf7b37deba (patch)
tree0e93a7ba613dcdbfd0c27961578afa624a4ae13a /src
parent25e197a6c84463e967065c64b5760b79884787cc (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/common/dcc.c2
-rw-r--r--src/common/fe.h1
-rw-r--r--src/common/hexchat.c8
-rw-r--r--src/common/ignore.c2
-rw-r--r--src/common/inbound.c2
-rw-r--r--src/common/server.c2
-rw-r--r--src/fe-gtk/fe-gtk.c6
-rw-r--r--src/fe-text/fe-text.c6
8 files changed, 21 insertions, 8 deletions
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 */
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index b2418b42..3e7b8499 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -345,6 +345,12 @@ fe_timeout_add (int interval, void *callback, void *userdata)
 	return g_timeout_add (interval, (GSourceFunc) callback, userdata);
 }
 
+int
+fe_timeout_add_seconds (int interval, void *callback, void *userdata)
+{
+	return g_timeout_add_seconds (interval, (GSourceFunc) callback, userdata);
+}
+
 void
 fe_timeout_remove (int tag)
 {
diff --git a/src/fe-text/fe-text.c b/src/fe-text/fe-text.c
index 209a3d03..7345ac6f 100644
--- a/src/fe-text/fe-text.c
+++ b/src/fe-text/fe-text.c
@@ -415,6 +415,12 @@ fe_timeout_add (int interval, void *callback, void *userdata)
 	return g_timeout_add (interval, (GSourceFunc) callback, userdata);
 }
 
+int
+fe_timeout_add_seconds (int interval, void *callback, void *userdata)
+{
+	return g_timeout_add_seconds (interval, (GSourceFunc) callback, userdata);
+}
+
 void
 fe_input_remove (int tag)
 {