]> git.0d.be Git - empathy.git/commitdiff
add empathy_tp_call_leave
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 22 Feb 2010 18:03:32 +0000 (18:03 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 30 Mar 2010 11:28:24 +0000 (13:28 +0200)
libempathy/empathy-tp-call.c
libempathy/empathy-tp-call.h

index 31b4fe9e47e4a856e7bf710a2502b0e82253c5a1..eafeead64459d21f000b0da6d7ea5dc952ec84e8 100644 (file)
@@ -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);
+}
index c5607d8d7a4f5f9cdedb149ed7e6694099a7e8d7..ed3ae0d9fdf2f7e2b7347d599cc0b4652d763287 100644 (file)
@@ -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__ */