diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-10 19:49:06 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-12 11:25:19 +0100 |
commit | 5fea368bffc42db3fbaaca4b48f86dd937aff239 (patch) | |
tree | 10c604d74e8f6c2af859cb74a6302b3031661bb5 /src/muc-factory.c | |
parent | 6fcba9164c643abbdfffa42b33d2cb3fe4e3bd65 (diff) | |
download | telepathy-gabble-5fea368bffc42db3fbaaca4b48f86dd937aff239.tar.gz |
GabbleMucFactory: announce tube channels individually
tp_channel_manager_emit_new_channels() is deprecated, because
announcing bundles of related channels together seemed a nice idea, but
it turns out to be really difficult to deal with in practice.
We preserve the order in which we did things, as much as possible:
the text channel is announced (if it's going to be) before any of the
tubes.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69194
Diffstat (limited to 'src/muc-factory.c')
-rw-r--r-- | src/muc-factory.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/muc-factory.c b/src/muc-factory.c index 0f1dbcb07..39f468509 100644 --- a/src/muc-factory.c +++ b/src/muc-factory.c @@ -266,56 +266,51 @@ muc_ready_cb (GabbleMucChannel *text_chan, { GabbleMucFactory *fac = GABBLE_MUC_FACTORY (data); GabbleMucFactoryPrivate *priv = fac->priv; - GHashTable *channels; TpBaseChannel *base = TP_BASE_CHANNEL (text_chan); - GSList *requests_satisfied_text = NULL; GQueue *tube_channels; DEBUG ("text chan=%p", text_chan); - channels = g_hash_table_new_full (g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify) g_slist_free); - requests_satisfied_text = g_hash_table_lookup ( priv->queued_requests, text_chan); g_hash_table_steal (priv->queued_requests, text_chan); requests_satisfied_text = g_slist_reverse (requests_satisfied_text); + /* only announce channels which are on the bus (requested or + * requested with an invite, not channels only around because they + * have to be) */ + if (tp_base_channel_is_registered (base)) + { + tp_channel_manager_emit_new_channel (fac, + TP_EXPORTABLE_CHANNEL (text_chan), requests_satisfied_text); + } + /* Announce tube channels now */ tube_channels = g_hash_table_lookup (priv->text_needed_for_tube, text_chan); + if (tube_channels != NULL) { GList *l; for (l = tube_channels->head; l != NULL; l = l->next) { - GabbleTubeIface *tube_chan = GABBLE_TUBE_IFACE (l->data); + TpExportableChannel *tube_chan = TP_EXPORTABLE_CHANNEL (l->data); GSList *requests_satisfied_tube; requests_satisfied_tube = g_hash_table_lookup ( priv->queued_requests, tube_chan); g_hash_table_steal (priv->queued_requests, tube_chan); + requests_satisfied_tube = g_slist_reverse (requests_satisfied_tube); - g_hash_table_insert (channels, tube_chan, requests_satisfied_tube); + tp_channel_manager_emit_new_channel (fac, tube_chan, + requests_satisfied_tube); + g_slist_free (requests_satisfied_tube); } g_hash_table_remove (priv->text_needed_for_tube, text_chan); } - - /* only announce channels which are on the bus (requested or - * requested with an invite, not channels only around because they - * have to be) */ - if (tp_base_channel_is_registered (base)) - { - tp_channel_manager_emit_new_channel (fac, - TP_EXPORTABLE_CHANNEL (text_chan), requests_satisfied_text); - } - - tp_channel_manager_emit_new_channels (fac, channels); - - g_hash_table_unref (channels); } static void |