[telepathy-gabble/master] use g_timeout_add_seconds() instead of g_timeout_add() where possible
Dafydd Harries
dafydd.harries at collabora.co.uk
Mon Aug 17 08:56:04 PDT 2009
---
src/connection.c | 2 +-
src/disco.c | 5 ++---
src/muc-channel.c | 11 ++++++-----
src/request-pipeline.c | 4 ++--
src/vcard-manager.c | 14 +++++++-------
tests/twisted/main-debug.c | 2 +-
6 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index d71b1c6..8bac48c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -74,7 +74,7 @@
#include "util.h"
#include "vcard-manager.h"
-static guint disco_reply_timeout = 5000;
+static guint disco_reply_timeout = 5;
#define DEFAULT_RESOURCE_FORMAT "Telepathy.%x"
diff --git a/src/disco.c b/src/disco.c
index f9e66fd..abd8247 100644
--- a/src/disco.c
+++ b/src/disco.c
@@ -458,8 +458,7 @@ gabble_disco_request (GabbleDisco *self, GabbleDiscoType type,
* @type: type of request
* @jid: Jabber ID to request on
* @node: node to request on @jid, or NULL
- * @timeout: the time until the request fails, in milliseconds (1/1000ths of
- * a second)
+ * @timeout: the time until the request fails, in seconds
* @callback: #GabbleDiscoCb to call on request fullfilment
* @object: GObject to bind request to. the callback will not be
* called if this object has been unrefed. NULL if not needed
@@ -519,7 +518,7 @@ gabble_disco_request_with_timeout (GabbleDisco *self, GabbleDiscoType type,
else
{
request->timer_id =
- g_timeout_add (timeout, timeout_request, request);
+ g_timeout_add_seconds (timeout, timeout_request, request);
lm_message_unref (msg);
return request;
}
diff --git a/src/muc-channel.c b/src/muc-channel.c
index 051a837..c5b6ab8 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -46,11 +46,11 @@
#include "util.h"
#include "presence-cache.h"
-#define DEFAULT_JOIN_TIMEOUT (180 * 1000)
+#define DEFAULT_JOIN_TIMEOUT 180
#define MAX_NICK_RETRIES 3
-#define PROPS_POLL_INTERVAL_LOW (60 * 1000 * 5)
-#define PROPS_POLL_INTERVAL_HIGH (60 * 1000)
+#define PROPS_POLL_INTERVAL_LOW 60 * 5
+#define PROPS_POLL_INTERVAL_HIGH 60
static void channel_iface_init (gpointer, gpointer);
static void password_iface_init (gpointer, gpointer);
@@ -1331,7 +1331,7 @@ channel_state_changed (GabbleMucChannel *chan,
if (new_state == MUC_STATE_INITIATED)
{
priv->join_timer_id =
- g_timeout_add (DEFAULT_JOIN_TIMEOUT, timeout_join, chan);
+ g_timeout_add_seconds (DEFAULT_JOIN_TIMEOUT, timeout_join, chan);
}
else if (new_state == MUC_STATE_JOINED)
{
@@ -1349,7 +1349,8 @@ channel_state_changed (GabbleMucChannel *chan,
else
interval = PROPS_POLL_INTERVAL_HIGH;
- priv->poll_timer_id = g_timeout_add (interval, timeout_poll, chan);
+ priv->poll_timer_id =
+ g_timeout_add_seconds (interval, timeout_poll, chan);
/* no need to keep this around any longer, if it's set */
g_free (priv->password);
diff --git a/src/request-pipeline.c b/src/request-pipeline.c
index f80d8b8..be4f696 100644
--- a/src/request-pipeline.c
+++ b/src/request-pipeline.c
@@ -29,7 +29,7 @@
#include "debug.h"
#include "util.h"
-#define DEFAULT_REQUEST_TIMEOUT 180000
+#define DEFAULT_REQUEST_TIMEOUT 180
#define REQUEST_PIPELINE_SIZE 10
/* Properties */
@@ -359,7 +359,7 @@ send_next_request (GabbleRequestPipeline *pipeline)
{
priv->items_in_flight = g_slist_prepend (priv->items_in_flight, item);
item->in_flight = TRUE;
- item->timer_id = g_timeout_add (item->timeout, timeout_cb, item);
+ item->timer_id = g_timeout_add_seconds (item->timeout, timeout_cb, item);
}
}
diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index 123584a..93e3bf2 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -37,7 +37,7 @@
#include "request-pipeline.h"
#include "util.h"
-#define DEFAULT_REQUEST_TIMEOUT 180000
+#define DEFAULT_REQUEST_TIMEOUT 180
#define VCARD_CACHE_ENTRY_TTL 60
static const gchar *NO_ALIAS = "none";
@@ -368,9 +368,8 @@ cache_entry_timeout (gpointer data)
if (entry)
{
- priv->cache_timer = g_timeout_add (
- 1000 * (entry->expires - time (NULL)),
- cache_entry_timeout, manager);
+ priv->cache_timer = g_timeout_add_seconds (
+ entry->expires - time (NULL), cache_entry_timeout, manager);
}
return FALSE;
@@ -1079,8 +1078,8 @@ pipeline_reply_cb (GabbleConnection *conn,
GabbleVCardCacheEntry *first =
tp_heap_peek_first (priv->timed_cache);
- priv->cache_timer = g_timeout_add (
- (first->expires - time (NULL)) * 1000, cache_entry_timeout, self);
+ priv->cache_timer = g_timeout_add_seconds (
+ first->expires - time (NULL), cache_entry_timeout, self);
}
/* We have freshly updated cache for our vCard, edit it if
@@ -1193,7 +1192,8 @@ gabble_vcard_manager_request (GabbleVCardManager *self,
request->entry->pending_requests = g_slist_prepend
(request->entry->pending_requests, request);
- request->timer_id = g_timeout_add (timeout, timeout_request, request);
+ request->timer_id =
+ g_timeout_add_seconds (timeout, timeout_request, request);
cache_entry_ensure_queued (request->entry, timeout);
return request;
}
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 2de68e2..95c8958 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -33,7 +33,7 @@ main (int argc,
gabble_init ();
/* needed for test-disco-no-reply.py */
- gabble_connection_set_disco_reply_timeout (3000);
+ gabble_connection_set_disco_reply_timeout (3);
gibber_resolver_set_resolver (GABBLE_TYPE_RESOLVER_FAKE);
gabble_jingle_factory_set_test_mode ();
--
1.5.6.5
More information about the telepathy-commits
mailing list