[telepathy-gabble/master] _caps_disco_cb: extract finding matching DiscoWaiter
Will Thompson
will.thompson at collabora.co.uk
Wed May 6 08:47:23 PDT 2009
---
src/presence-cache.c | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/presence-cache.c b/src/presence-cache.c
index 1214b57..be5d2bd 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -877,6 +877,23 @@ disco_failed (GabblePresenceCache *cache,
g_free (full_jid);
}
+static DiscoWaiter *
+find_matching_waiter (GSList *waiters,
+ TpHandle handle)
+{
+ GSList *i;
+
+ for (i = waiters; NULL != i; i = i->next)
+ {
+ DiscoWaiter *waiter = i->data;
+
+ if (waiter->handle == handle)
+ return waiter;
+ }
+
+ return NULL;
+}
+
static void
_caps_disco_cb (GabbleDisco *disco,
GabbleDiscoRequest *request,
@@ -954,18 +971,8 @@ _caps_disco_cb (GabbleDisco *disco,
goto OUT;
}
- waiter_self = NULL;
- for (i = waiters; NULL != i; i = i->next)
- {
- DiscoWaiter *waiter;
+ waiter_self = find_matching_waiter (waiters, handle);
- waiter = (DiscoWaiter *) i->data;
- if (waiter->handle == handle)
- {
- waiter_self = waiter;
- break;
- }
- }
if (NULL == waiter_self)
{
DEBUG ("Ignoring non requested disco reply");
--
1.5.6.5
More information about the telepathy-commits
mailing list