summaryrefslogtreecommitdiff
path: root/src/idle-muc-manager.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-11-14 16:43:46 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2012-11-14 17:10:54 +0000
commit39ee2f08cf4e2d46aae86307f6dfa023fe347248 (patch)
treefef2e4d2a0f40fed89c9eb619f5fd3e28c88a51e /src/idle-muc-manager.c
parentf51c7b9cd378a561a9926d0860c26b7581dd4dc0 (diff)
muc-channel: implement Destroy(), make Close() respawn
This fixes the issue where empathy-chat crashing means you get kicked out of all your channels. It's technically backwards-incompatible but empathy-chat has been using RemoveMembers() to leave rooms for ages, and it's a pretty destructive and annoying bug, so let's just get on with it. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24614
Diffstat (limited to 'src/idle-muc-manager.c')
-rw-r--r--src/idle-muc-manager.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/idle-muc-manager.c b/src/idle-muc-manager.c
index 5cba4d7..faf66e9 100644
--- a/src/idle-muc-manager.c
+++ b/src/idle-muc-manager.c
@@ -676,6 +676,7 @@ static GSList *take_request_tokens(IdleMUCManager *manager, IdleMUCChannel *chan
static void _channel_closed_cb(IdleMUCChannel *chan, gpointer user_data) {
IdleMUCManager *manager = IDLE_MUC_MANAGER(user_data);
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(manager);
+ TpBaseChannel *base = TP_BASE_CHANNEL (chan);
GSList *reqs = take_request_tokens(user_data, chan);
/* If there are any tokens for this channel when it closes, the request
@@ -689,10 +690,17 @@ static void _channel_closed_cb(IdleMUCChannel *chan, gpointer user_data) {
g_slist_free(reqs);
+ tp_channel_manager_emit_channel_closed_for_object (manager,
+ TP_EXPORTABLE_CHANNEL (chan));
+
if (priv->channels) {
- TpHandle handle;
- g_object_get(chan, "handle", &handle, NULL);
- g_hash_table_remove(priv->channels, GUINT_TO_POINTER(handle));
+ TpHandle handle = tp_base_channel_get_target_handle (base);
+
+ if (tp_base_channel_is_destroyed (base))
+ g_hash_table_remove(priv->channels, GUINT_TO_POINTER(handle));
+ else
+ tp_channel_manager_emit_new_channel (manager, TP_EXPORTABLE_CHANNEL (chan),
+ NULL);
}
}