[Telepathy-commits] [telepathy-gabble/master] GabbleMucFactory: correctly fail requests when joining a MUC fails

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Aug 21 06:31:59 PDT 2008


20080805150019-53eee-bc38baec7e2553a9ad530a21f6f15ce4e19ffb1f.gz
---
 src/muc-factory.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/muc-factory.c b/src/muc-factory.c
index 7dcd06f..582e11d 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -337,18 +337,45 @@ muc_join_error_cb (GabbleMucChannel *chan,
   GabbleMucFactory *fac = GABBLE_MUC_FACTORY (data);
   GabbleMucFactoryPrivate *priv = GABBLE_MUC_FACTORY_GET_PRIVATE (fac);
   GabbleTubesChannel *tubes_chan;
+  GSList *requests_satisfied;
+  GSList *iter;
 
   DEBUG ("error->code=%u, error->message=\"%s\"", error->code, error->message);
 
   tp_channel_factory_iface_emit_channel_error (fac, (TpChannelIface *) chan,
       error, NULL);
 
+  requests_satisfied = g_slist_reverse (g_hash_table_lookup (
+        priv->queued_requests, chan));
+  g_hash_table_steal (priv->queued_requests, chan);
+
+  for (iter = requests_satisfied; iter != NULL; iter = iter->next)
+    {
+      gabble_channel_manager_emit_request_failed (fac, iter->data,
+          error->domain, error->code, error->message);
+    }
+
+  g_slist_free (requests_satisfied);
+
   tubes_chan = g_hash_table_lookup (priv->text_needed_for_tubes, chan);
+
   if (tubes_chan != NULL)
     {
       g_hash_table_remove (priv->text_needed_for_tubes, chan);
       tp_channel_factory_iface_emit_channel_error (fac,
           (TpChannelIface *) tubes_chan, error, NULL);
+
+      requests_satisfied = g_slist_reverse (g_hash_table_lookup (
+            priv->queued_requests, tubes_chan));
+      g_hash_table_steal (priv->queued_requests, tubes_chan);
+
+      for (iter = requests_satisfied; iter != NULL; iter = iter->next)
+        {
+          gabble_channel_manager_emit_request_failed (fac, iter->data,
+              error->domain, error->code, error->message);
+        }
+
+      g_slist_free (requests_satisfied);
     }
 }
 
-- 
1.5.6.3




More information about the Telepathy-commits mailing list