aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-02-19 23:43:17 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-02-19 23:43:17 +0800
commitc8166c52a0b133c3af082277270d3f911f634163 (patch)
tree4693f11c3092dddf68b17705b7d573e239ce3b89
parent998ef19cf8a2e546208d1fb0a835032a7e07e543 (diff)
downloadgsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.tar
gsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.tar.gz
gsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.tar.bz2
gsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.tar.lz
gsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.tar.xz
gsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.tar.zst
gsoc2013-empathy-c8166c52a0b133c3af082277270d3f911f634163.zip
empathy_tp_chat_leave: try to remove the self-handle instead of closing (#610461)
-rw-r--r--libempathy/empathy-tp-chat.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 0b19a6680..3c613245c 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1805,8 +1805,42 @@ empathy_tp_chat_can_add_contact (EmpathyTpChat *self)
TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP);;
}
+static void
+leave_remove_members_cb (TpChannel *proxy,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ EmpathyTpChat *self = user_data;
+
+ if (error == NULL)
+ return;
+
+ DEBUG ("RemoveMembers failed (%s); closing the channel", error->message);
+ empathy_tp_chat_close (self);
+}
+
void
empathy_tp_chat_leave (EmpathyTpChat *self)
{
- empathy_tp_chat_close (self);
+ EmpathyTpChatPriv *priv = GET_PRIV (self);
+ TpHandle self_handle;
+ GArray *array;
+
+ if (!tp_proxy_has_interface_by_id (priv->channel,
+ TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP))
+ empathy_tp_chat_close (self);
+
+ self_handle = tp_channel_group_get_self_handle (priv->channel);
+ if (self_handle == 0)
+ /* we are not member of the channel */
+ empathy_tp_chat_close (self);
+
+ array = g_array_sized_new (FALSE, FALSE, sizeof (TpHandle), 1);
+ g_array_insert_val (array, 0, self_handle);
+
+ tp_cli_channel_interface_group_call_remove_members (priv->channel, -1, array,
+ "", leave_remove_members_cb, self, NULL, G_OBJECT (self));
+
+ g_array_free (array, TRUE);
}