[Telepathy-commits] [telepathy-glib/master] ExampleCallableMediaChannel: allow streams to be removed

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Mar 11 05:56:36 PDT 2009


---
 examples/cm/callable/media-channel.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/examples/cm/callable/media-channel.c b/examples/cm/callable/media-channel.c
index 52e6d6a..d13de95 100644
--- a/examples/cm/callable/media-channel.c
+++ b/examples/cm/callable/media-channel.c
@@ -681,9 +681,31 @@ media_remove_streams (TpSvcChannelTypeStreamedMedia *iface,
                       DBusGMethodInvocation *context)
 {
   ExampleCallableMediaChannel *self = EXAMPLE_CALLABLE_MEDIA_CHANNEL (iface);
+  guint i;
 
-  /* FIXME */
-  (void) self;
+  for (i = 0; i < stream_ids->len; i++)
+    {
+      guint id = g_array_index (stream_ids, guint, i);
+
+      if (g_hash_table_lookup (self->priv->streams,
+            GUINT_TO_POINTER (id)) == NULL)
+        {
+          GError *error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+              "No stream with ID %u in this channel", id);
+
+          dbus_g_method_return_error (context, error);
+          g_error_free (error);
+          return;
+        }
+    }
+
+  for (i = 0; i < stream_ids->len; i++)
+    {
+      guint id = g_array_index (stream_ids, guint, i);
+
+      example_callable_media_stream_close (
+          g_hash_table_lookup (self->priv->streams, GUINT_TO_POINTER (id)));
+    }
 
   tp_svc_channel_type_streamed_media_return_from_remove_streams (context);
 }
-- 
1.5.6.5




More information about the telepathy-commits mailing list