summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2012-02-01 18:33:51 (GMT)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2012-02-14 15:35:33 (GMT)
commit5b70e100fcfee015f204b03381960fe49af83e30 (patch)
treeaa78a66a7f1f2823a94fd4547bb19be71f259a43
parentb3cb12d0f32a4424efd708bd0bde5f3179a81a85 (diff)
downloadtelepathy-glib-5b70e100fcfee015f204b03381960fe49af83e30.tar.gz
telepathy-glib-5b70e100fcfee015f204b03381960fe49af83e30.tar.xz
BaseMediaCallStream: Add function to remove endpoints
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/base-media-call-stream.c42
-rw-r--r--telepathy-glib/base-media-call-stream.h2
3 files changed, 45 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index c444963..741fe23 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -6942,6 +6942,7 @@ TpBaseMediaCallStreamSetSendingFunc
tp_base_media_call_stream_set_relay_info
tp_base_media_call_stream_set_stun_servers
tp_base_media_call_stream_add_endpoint
+tp_base_media_call_stream_remove_endpoint
tp_base_media_call_stream_get_endpoints
tp_base_media_call_stream_get_username
tp_base_media_call_stream_get_password
diff --git a/telepathy-glib/base-media-call-stream.c b/telepathy-glib/base-media-call-stream.c
index 5d1f149..b27b4d5 100644
--- a/telepathy-glib/base-media-call-stream.c
+++ b/telepathy-glib/base-media-call-stream.c
@@ -701,6 +701,48 @@ tp_base_media_call_stream_add_endpoint (TpBaseMediaCallStream *self,
g_ptr_array_unref (removed);
}
+
+/**
+ * tp_base_media_call_stream_remove_endpoint:
+ * @self: a #TpBaseMediaCallStream
+ * @endpoint: a #TpCallStreamEndpoint
+ *
+ * Remove @endpoint from #TpBaseMediaCallStream:endpoints list, and emits
+ * EndpointsChanged DBus signal.
+ *
+ * Since: 0.UNRELEASED
+ */
+void
+tp_base_media_call_stream_remove_endpoint (TpBaseMediaCallStream *self,
+ TpCallStreamEndpoint *endpoint)
+{
+ const gchar *object_path;
+ GPtrArray *added;
+ GPtrArray *removed;
+
+ g_return_if_fail (TP_IS_BASE_MEDIA_CALL_STREAM (self));
+ g_return_if_fail (TP_IS_CALL_STREAM_ENDPOINT (endpoint));
+ g_return_if_fail (g_list_find (self->priv->endpoints, endpoint) != NULL);
+
+ object_path = tp_call_stream_endpoint_get_object_path (endpoint);
+ DEBUG ("Remove endpoint %s from stream %s", object_path,
+ tp_base_call_stream_get_object_path ((TpBaseCallStream *) self));
+
+ self->priv->endpoints = g_list_remove (self->priv->endpoints,
+ endpoint);
+
+ added = g_ptr_array_new ();
+ removed = g_ptr_array_new ();
+ g_ptr_array_add (removed, (gpointer) object_path);
+
+ tp_svc_call_stream_interface_media_emit_endpoints_changed (self,
+ added, removed);
+
+ g_ptr_array_unref (added);
+ g_ptr_array_unref (removed);
+ g_object_unref (endpoint);
+}
+
/**
* tp_base_media_call_stream_get_endpoints:
* @self: a #TpBaseMediaCallStream
diff --git a/telepathy-glib/base-media-call-stream.h b/telepathy-glib/base-media-call-stream.h
index e73788a..f79f9cf 100644
--- a/telepathy-glib/base-media-call-stream.h
+++ b/telepathy-glib/base-media-call-stream.h
@@ -99,6 +99,8 @@ void tp_base_media_call_stream_set_stun_servers (TpBaseMediaCallStream *self,
GPtrArray *stun_servers);
void tp_base_media_call_stream_add_endpoint (TpBaseMediaCallStream *self,
TpCallStreamEndpoint *endpoint);
+void tp_base_media_call_stream_remove_endpoint (TpBaseMediaCallStream *self,
+ TpCallStreamEndpoint *endpoint);
GList *tp_base_media_call_stream_get_endpoints (TpBaseMediaCallStream *self);
const gchar *tp_base_media_call_stream_get_username (
TpBaseMediaCallStream *self);