[Telepathy-commits] [telepathy-gabble/master] conn-requests: factor out fail_request()

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Nov 3 11:20:46 PST 2008


20080729195159-53eee-96dddd63d2e4b24c3f42d6cdaaadacd2f801c4ea.gz
---
 src/conn-requests.c |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/conn-requests.c b/src/conn-requests.c
index 4b3c1a0..c9fdd89 100644
--- a/src/conn-requests.c
+++ b/src/conn-requests.c
@@ -336,6 +336,26 @@ connection_new_channel_cb (TpChannelFactoryIface *factory,
   g_signal_connect (chan, "closed", (GCallback) channel_closed_cb, data);
 }
 
+
+static void
+fail_channel_request (GabbleConnection *self,
+                      ChannelRequest *request,
+                      GError *error)
+{
+  DEBUG ("completing queued request %p with error, channel_type=%s, "
+      "handle_type=%u, handle=%u, suppress_handler=%u",
+      request, request->channel_type,
+      request->handle_type, request->handle, request->suppress_handler);
+
+  dbus_g_method_return_error (request->context, error);
+  request->context = NULL;
+
+  g_ptr_array_remove (self->channel_requests, request);
+
+  channel_request_free (request);
+}
+
+
 static void
 connection_channel_error_cb (TpChannelFactoryIface *factory,
                              GObject *chan,
@@ -363,21 +383,7 @@ connection_channel_error_cb (TpChannelFactoryIface *factory,
                                         handle, channel_request, NULL);
 
   for (i = 0; i < tmp->len; i++)
-    {
-      ChannelRequest *request = g_ptr_array_index (tmp, i);
-
-      DEBUG ("completing queued request %p with error, channel_type=%s, "
-          "handle_type=%u, handle=%u, suppress_handler=%u",
-          request, request->channel_type,
-          request->handle_type, request->handle, request->suppress_handler);
-
-      dbus_g_method_return_error (request->context, error);
-      request->context = NULL;
-
-      g_ptr_array_remove (self->channel_requests, request);
-
-      channel_request_free (request);
-    }
+    fail_channel_request (self, g_ptr_array_index (tmp, i), error);
 
   g_ptr_array_free (tmp, TRUE);
   g_free (channel_type);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list