pidgin/pidgin

Use g_timeout_add_seconds some more.

2020-05-17, Elliott Sales de Andrade
c0905847d779
Parents 0908be6e73de
Children 3f7b41f7fae8
Use g_timeout_add_seconds some more.
--- a/finch/gntconn.c Wed May 13 02:01:23 2020 +0000
+++ b/finch/gntconn.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/finch/gntdebug.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/protocols/facebook/data.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/protocols/facebook/data.h Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/protocols/facebook/facebook.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/protocols/facebook/mqtt.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/protocols/facebook/mqtt.h Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/protocols/simple/simple.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/libpurple/upnp.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/pidgin/gtkconn.c Sun May 17 22:46:04 2020 -0400
@@ -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 Wed May 13 02:01:23 2020 +0000
+++ b/pidgin/plugins/ticker/ticker.c Sun May 17 22:46:04 2020 -0400
@@ -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) {