diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-02-23 02:03:32 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-30 19:28:24 +0800 |
commit | c95542fa3be19a5350bec6b631d97a4734e9f27d (patch) | |
tree | 1b7a7929bd52ddf9053432957e49420736857bfb /libempathy | |
parent | 09c8c6dee9aaf2ff5e19bc78c3c59d5013098990 (diff) | |
download | gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.tar gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.tar.gz gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.tar.bz2 gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.tar.lz gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.tar.xz gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.tar.zst gsoc2013-empathy-c95542fa3be19a5350bec6b631d97a4734e9f27d.zip |
add empathy_tp_call_leave
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-call.c | 46 | ||||
-rw-r--r-- | 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 31b4fe9e4..eafeead64 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 c5607d8d7..ed3ae0d9f 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__ */ |