aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-chat.c2
-rw-r--r--libempathy/empathy-tp-chat.c60
-rw-r--r--libempathy/empathy-tp-chat.h3
-rw-r--r--src/empathy-event-manager.c2
4 files changed, 19 insertions, 48 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index b8e8789c5..fbe2425b6 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -2765,7 +2765,7 @@ chat_finalize (GObject *object)
chat_members_changed_cb, chat);
g_signal_handlers_disconnect_by_func (priv->tp_chat,
chat_remote_contact_changed_cb, chat);
- empathy_tp_chat_leave (priv->tp_chat);
+ empathy_tp_chat_leave (priv->tp_chat, "");
g_object_unref (priv->tp_chat);
}
if (priv->account) {
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index e24ba84f5..20692a188 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1185,7 +1185,7 @@ tp_chat_got_remote_contact_cb (TpConnection *connection,
if (error) {
DEBUG ("Error: %s", error->message);
- empathy_tp_chat_leave (EMPATHY_TP_CHAT (chat));
+ empathy_tp_chat_leave (EMPATHY_TP_CHAT (chat), "");
return;
}
@@ -1206,7 +1206,7 @@ tp_chat_got_self_contact_cb (TpConnection *connection,
if (error) {
DEBUG ("Error: %s", error->message);
- empathy_tp_chat_leave (EMPATHY_TP_CHAT (chat));
+ empathy_tp_chat_leave (EMPATHY_TP_CHAT (chat), "");
return;
}
@@ -1557,16 +1557,6 @@ empathy_tp_chat_new (TpAccount *account,
NULL);
}
-static void
-empathy_tp_chat_close (EmpathyTpChat *chat) {
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
-
- /* If there are still messages left, it'll come back..
- * We loose the ordering of sent messages though */
- tp_cli_channel_call_close (priv->channel, -1, tp_chat_async_cb,
- "closing channel", NULL, NULL);
-}
-
const gchar *
empathy_tp_chat_get_id (EmpathyTpChat *chat)
{
@@ -1867,47 +1857,27 @@ empathy_tp_chat_can_add_contact (EmpathyTpChat *self)
}
static void
-leave_remove_members_cb (TpChannel *proxy,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
+tp_channel_leave_async_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- EmpathyTpChat *self = user_data;
-
- if (error == NULL)
- return;
+ GError *error = NULL;
- DEBUG ("RemoveMembers failed (%s); closing the channel", error->message);
- empathy_tp_chat_close (self);
+ if (!tp_channel_leave_finish (TP_CHANNEL (source_object), res, &error)) {
+ DEBUG ("Could not leave channel properly: (%s); closing the channel",
+ error->message);
+ g_error_free (error);
+ }
}
void
-empathy_tp_chat_leave (EmpathyTpChat *self)
+empathy_tp_chat_leave (EmpathyTpChat *self,
+ const gchar *message)
{
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);
- return;
- }
-
- 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);
- return;
- }
-
- 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);
+ tp_channel_leave_async (priv->channel, TP_CHANNEL_GROUP_CHANGE_REASON_NONE,
+ message, tp_channel_leave_async_cb, self);
}
static void
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index 8511335cf..7c83bec77 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -100,7 +100,8 @@ gboolean empathy_tp_chat_provide_password_finish (EmpathyTpChat *chat,
GError **error);
gboolean empathy_tp_chat_can_add_contact (EmpathyTpChat *self);
-void empathy_tp_chat_leave (EmpathyTpChat *chat);
+void empathy_tp_chat_leave (EmpathyTpChat *chat,
+ const gchar *message);
void empathy_tp_chat_join (EmpathyTpChat *chat);
gboolean empathy_tp_chat_is_invited (EmpathyTpChat *chat,
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 9699a3a07..599a6a48e 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -409,7 +409,7 @@ reject_channel_claim_cb (GObject *source,
}
else if (EMPATHY_IS_TP_CHAT (user_data))
{
- empathy_tp_chat_leave (user_data);
+ empathy_tp_chat_leave (user_data, "");
}
else if (EMPATHY_IS_TP_FILE (user_data))
{