[empathy] add empathy_tp_call_leave
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] add empathy_tp_call_leave
- Date: Tue, 30 Mar 2010 11:32:57 +0000 (UTC)
commit c95542fa3be19a5350bec6b631d97a4734e9f27d
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Mon Feb 22 18:03:32 2010 +0000
add empathy_tp_call_leave
libempathy/empathy-tp-call.c | 46 ++++++++++++++++++++++++++++++++++++++++++
libempathy/empathy-tp-call.h | 2 +
2 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 31b4fe9..eafeead 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -816,3 +816,49 @@ empathy_tp_call_has_initial_video (EmpathyTpCall *self)
g_hash_table_unref (props);
return initial_video;
}
+
+static void
+leave_remove_members_cb (TpChannel *proxy,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ EmpathyTpCall *self = user_data;
+
+ if (error == NULL)
+ return;
+
+ DEBUG ("RemoveMembers failed (%s); closing the channel", error->message);
+ empathy_tp_call_close (self);
+}
+
+void
+empathy_tp_call_leave (EmpathyTpCall *self)
+{
+ EmpathyTpCallPriv *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_call_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_call_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);
+}
diff --git a/libempathy/empathy-tp-call.h b/libempathy/empathy-tp-call.h
index c5607d8..ed3ae0d 100644
--- a/libempathy/empathy-tp-call.h
+++ b/libempathy/empathy-tp-call.h
@@ -92,6 +92,8 @@ const gchar * empathy_tp_call_get_connection_manager (EmpathyTpCall *self);
gboolean empathy_tp_call_has_initial_video (EmpathyTpCall *self);
+void empathy_tp_call_leave (EmpathyTpCall *self);
+
G_END_DECLS
#endif /* __EMPATHY_TP_CALL_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]