Merged in default (pull request #698)

Tue, 19 May 2020 10:14:43 +0000

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 19 May 2020 10:14:43 +0000
changeset 40413
3f7b41f7fae8
parent 40411
188bfd55da54 (current diff)
parent 40412
c0905847d779 (diff)
child 40417
48c621e76141

Merged in default (pull request #698)

Use g_timeout_add_seconds some more.

Approved-by: Gary Kramlich

--- a/finch/gntconn.c	Mon May 18 20:13:50 2020 -0400
+++ b/finch/gntconn.c	Tue May 19 10:14:43 2020 +0000
@@ -28,10 +28,10 @@
 #include "gntaccount.h"
 #include "gntconn.h"
 
-#define INITIAL_RECON_DELAY_MIN  8000
-#define INITIAL_RECON_DELAY_MAX 60000
+#define INITIAL_RECON_DELAY_MIN 8
+#define INITIAL_RECON_DELAY_MAX 60
 
-#define MAX_RECON_DELAY 600000
+#define MAX_RECON_DELAY 600
 
 typedef struct {
 	int delay;
@@ -113,7 +113,7 @@
 			if (info->timeout != 0)
 				g_source_remove(info->timeout);
 		}
-		info->timeout = g_timeout_add(info->delay, do_signon, account);
+		info->timeout = g_timeout_add_seconds(info->delay, do_signon, account);
 	} else {
 		char *act, *primary, *secondary;
 		act = g_strdup_printf(_("%s (%s)"), purple_account_get_username(account),
--- a/finch/gntdebug.c	Mon May 18 20:13:50 2020 -0400
+++ b/finch/gntdebug.c	Tue May 19 10:14:43 2020 +0000
@@ -263,7 +263,7 @@
 static void
 update_filter_string(GntEntry *entry, gpointer null)
 {
-	int id = g_timeout_add(1000, for_real, entry);
+	int id = g_timeout_add_seconds(1, for_real, entry);
 	g_object_set_data_full(G_OBJECT(entry), "update-filter", GINT_TO_POINTER(id),
 					(GDestroyNotify)g_source_remove);
 }
--- a/libpurple/protocols/facebook/data.c	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/protocols/facebook/data.c	Tue May 19 10:14:43 2020 +0000
@@ -300,7 +300,7 @@
 	fb_data_clear_timeout(fata, name, TRUE);
 
 	key = g_strdup(name);
-	id = g_timeout_add(interval, func, data);
+	id = g_timeout_add_seconds(interval, func, data);
 	g_hash_table_replace(priv->evs, key, GUINT_TO_POINTER(id));
 }
 
--- a/libpurple/protocols/facebook/data.h	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/protocols/facebook/data.h	Tue May 19 10:14:43 2020 +0000
@@ -115,7 +115,7 @@
  * fb_data_add_timeout:
  * @fata: The #FbData.
  * @name: The name of the timeout.
- * @interval: The time, in milliseconds, between calls to @func.
+ * @interval: The time, in seconds, between calls to @func.
  * @func: The #GSourceFunc.
  * @data: The data passed to @func.
  *
--- a/libpurple/protocols/facebook/facebook.c	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/protocols/facebook/facebook.c	Tue May 19 10:14:43 2020 +0000
@@ -202,7 +202,7 @@
 		sync = 1;
 	}
 
-	sync *= 60 * 1000;
+	sync *= 60;
 	fb_data_add_timeout(fata, "sync-contacts", sync, fb_cb_sync_contacts,
 	                    fata);
 }
@@ -867,7 +867,7 @@
 		/* Use event loop for purple_conversation_has_focus() */
 		name = purple_conversation_get_name(conv);
 		tname = g_strconcat("conv-read-", name, NULL);
-		fb_data_add_timeout(fata, tname, 1, fb_cb_conv_read, conv);
+		fb_data_add_timeout(fata, tname, 0, fb_cb_conv_read, conv);
 		g_free(tname);
 	}
 }
--- a/libpurple/protocols/facebook/mqtt.c	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/protocols/facebook/mqtt.c	Tue May 19 10:14:43 2020 +0000
@@ -338,8 +338,8 @@
 	FbMqttPrivate *priv = mqtt->priv;
 
 	fb_mqtt_timeout_clear(mqtt);
-	priv->tev = g_timeout_add(FB_MQTT_TIMEOUT_CONN,
-	                               fb_mqtt_cb_timeout, mqtt);
+	priv->tev = g_timeout_add_seconds(FB_MQTT_TIMEOUT_CONN, fb_mqtt_cb_timeout,
+	                                  mqtt);
 }
 
 static gboolean
@@ -364,8 +364,8 @@
 	FbMqttPrivate *priv = mqtt->priv;
 
 	fb_mqtt_timeout_clear(mqtt);
-	priv->tev = g_timeout_add(FB_MQTT_TIMEOUT_PING,
-	                               fb_mqtt_cb_ping, mqtt);
+	priv->tev =
+	        g_timeout_add_seconds(FB_MQTT_TIMEOUT_PING, fb_mqtt_cb_ping, mqtt);
 }
 
 static void
--- a/libpurple/protocols/facebook/mqtt.h	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/protocols/facebook/mqtt.h	Tue May 19 10:14:43 2020 +0000
@@ -77,17 +77,16 @@
 /**
  * FB_MQTT_TIMEOUT_CONN:
  *
- * The timeout, in milliseconds, to wait for a PING back from the
- * server.
+ * The timeout, in seconds, to wait for a PING back from the server.
  */
-#define FB_MQTT_TIMEOUT_CONN  (FB_MQTT_KA * 1500)
+#define FB_MQTT_TIMEOUT_CONN ((guint)(FB_MQTT_KA * 1.5))
 
 /**
  * FB_MQTT_TIMEOUT_PING:
  *
- * The timeout, in milliseconds, to send a PING to the server.
+ * The timeout, in seconds, to send a PING to the server.
  */
-#define FB_MQTT_TIMEOUT_PING  (FB_MQTT_KA * 1000)
+#define FB_MQTT_TIMEOUT_PING (FB_MQTT_KA)
 
 /**
  * FB_MQTT_ERROR:
--- a/libpurple/protocols/simple/simple.c	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/protocols/simple/simple.c	Tue May 19 10:14:43 2020 +0000
@@ -1811,7 +1811,8 @@
 
 	conn = connection_create(sip, source);
 
-	sip->registertimeout = g_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip);
+	sip->registertimeout = g_timeout_add_seconds(
+	        g_random_int_range(10, 100), (GSourceFunc)subscribe_timeout, sip);
 
 	do_register(sip);
 
@@ -1854,7 +1855,8 @@
 	sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc);
 
 	sip->resendtimeout = g_timeout_add(2500, (GSourceFunc) resend_timeout, sip);
-	sip->registertimeout = g_timeout_add(g_random_int_range(10000, 100000), (GSourceFunc)subscribe_timeout, sip);
+	sip->registertimeout = g_timeout_add_seconds(
+	        g_random_int_range(10, 100), (GSourceFunc)subscribe_timeout, sip);
 	do_register(sip);
 }
 
--- a/libpurple/upnp.c	Mon May 18 20:13:50 2020 -0400
+++ b/libpurple/upnp.c	Tue May 19 10:14:43 2020 +0000
@@ -38,7 +38,7 @@
 ****************************************************************/
 #define HTTP_OK "200 OK"
 #define DEFAULT_HTTP_PORT 80
-#define DISCOVERY_TIMEOUT 1000
+#define DISCOVERY_TIMEOUT 1
 /* limit UPnP-triggered http downloads to 128k */
 #define MAX_UPNP_DOWNLOAD (128 * 1024)
 
@@ -583,8 +583,8 @@
 		g_free(sendMessage);
 
 		if(sentSuccess) {
-			dd->tima = g_timeout_add(DISCOVERY_TIMEOUT,
-				purple_upnp_discover_timeout, dd);
+			dd->tima = g_timeout_add_seconds(DISCOVERY_TIMEOUT,
+			                                 purple_upnp_discover_timeout, dd);
 			dd->inpa = purple_input_add(dd->fd, PURPLE_INPUT_READ,
 				purple_upnp_discover_udp_read, dd);
 
--- a/pidgin/gtkconn.c	Mon May 18 20:13:50 2020 -0400
+++ b/pidgin/gtkconn.c	Tue May 19 10:14:43 2020 +0000
@@ -30,10 +30,10 @@
 #include "pidginstock.h"
 #include "gtkutils.h"
 
-#define INITIAL_RECON_DELAY_MIN  8000
-#define INITIAL_RECON_DELAY_MAX 60000
+#define INITIAL_RECON_DELAY_MIN 8
+#define INITIAL_RECON_DELAY_MAX 60
 
-#define MAX_RECON_DELAY 600000
+#define MAX_RECON_DELAY 600
 #define MAX_RACCOON_DELAY "shorter in urban areas"
 
 typedef struct {
@@ -148,7 +148,7 @@
 			if (info->timeout != 0)
 				g_source_remove(info->timeout);
 		}
-		info->timeout = g_timeout_add(info->delay, do_signon, account);
+		info->timeout = g_timeout_add_seconds(info->delay, do_signon, account);
 	} else {
 		if (info != NULL)
 			g_hash_table_remove(auto_reconns, account);
--- a/pidgin/plugins/ticker/ticker.c	Mon May 18 20:13:50 2020 -0400
+++ b/pidgin/plugins/ticker/ticker.c	Tue May 19 10:14:43 2020 +0000
@@ -179,7 +179,7 @@
 	 * Update the icon in a few seconds (after the open door icon has
 	 * changed).  This is somewhat ugly.
 	 */
-	td->timeout = g_timeout_add(11000, buddy_ticker_set_pixmap_cb, td);
+	td->timeout = g_timeout_add_seconds(11, buddy_ticker_set_pixmap_cb, td);
 }
 
 static void ticker_data_free(TickerData *td) {

mercurial