[Telepathy-commits] [telepathy-gabble/master] Don't crash on setting presence if there are open MUC Tubes
Will Thompson
will.thompson at collabora.co.uk
Mon Dec 29 07:53:50 PST 2008
The previous code iterated across all channels managed by
GabbleMucFactory and cast them to GabbleMucChannel; if there are open
tubes, the cast is invalid for them.
---
src/connection.c | 5 +----
src/muc-factory.c | 17 +++++++++++++++++
src/muc-factory.h | 2 ++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index 7b8ebfd..f0ccae8 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1382,10 +1382,7 @@ _gabble_connection_signal_own_presence (GabbleConnection *self, GError **error)
g_free (caps_hash);
lm_message_unref (message);
- /* broadcast presence to MUCs */
- tp_channel_manager_foreach_channel (
- TP_CHANNEL_MANAGER (self->muc_factory),
- (TpExportableChannelFunc) gabble_muc_channel_send_presence, NULL);
+ gabble_muc_factory_broadcast_presence (self->muc_factory);
return ret;
}
diff --git a/src/muc-factory.c b/src/muc-factory.c
index 4ff888b..c5f6bf2 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -992,6 +992,23 @@ muc_factory_presence_cb (LmMessageHandler *handler,
}
+void
+gabble_muc_factory_broadcast_presence (GabbleMucFactory *self)
+{
+ GabbleMucFactoryPrivate *priv = GABBLE_MUC_FACTORY_GET_PRIVATE (self);
+ GHashTableIter iter;
+ GabbleMucChannel *channel = NULL;
+
+ g_hash_table_iter_init (&iter, priv->text_channels);
+
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &channel))
+ {
+ g_assert (GABBLE_IS_MUC_CHANNEL (channel));
+ gabble_muc_channel_send_presence (channel, NULL);
+ }
+}
+
+
static void
gabble_muc_factory_associate_request (GabbleMucFactory *self,
gpointer channel,
diff --git a/src/muc-factory.h b/src/muc-factory.h
index 150e609..c17935e 100644
--- a/src/muc-factory.h
+++ b/src/muc-factory.h
@@ -64,6 +64,8 @@ void gabble_muc_factory_handle_si_stream_request (GabbleMucFactory *self,
GabbleBytestreamIface *bytestream, TpHandle room_handle,
const gchar *stream_id, LmMessage *msg);
+void gabble_muc_factory_broadcast_presence (GabbleMucFactory *self);
+
G_END_DECLS
#endif /* #ifndef __MUC_FACTORY_H__ */
--
1.5.6.5
More information about the Telepathy-commits
mailing list