[Telepathy-commits] [telepathy-gabble/master] Make CodecsUpdated fail until codecs have been provided

Will Thompson will.thompson at collabora.co.uk
Thu Feb 26 09:03:08 PST 2009


---
 src/media-stream.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/media-stream.c b/src/media-stream.c
index fdebeab..117f0d0 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -1224,13 +1224,22 @@ gabble_media_stream_codecs_updated (TpSvcMediaStreamHandler *iface,
                                     DBusGMethodInvocation *context)
 {
   GabbleMediaStream *self = GABBLE_MEDIA_STREAM (iface);
+  gboolean codecs_set =
+      (g_value_get_boxed (&self->priv->native_codecs) != NULL);
 
-  /* FIXME: we assume codecs have already been set (by set_local_codecs
-   * or supported_codecs(), depending on who's stream creator. */
-
-  pass_local_codecs (self, codecs);
+  if (codecs_set)
+    {
+      pass_local_codecs (self, codecs);
+      tp_svc_media_stream_handler_return_from_codecs_updated (context);
+    }
+  else
+    {
+      GError e = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+          "CodecsUpdated may only be called once an initial set of codecs "
+          "has been set" };
 
-  tp_svc_media_stream_handler_return_from_codecs_updated (context);
+      dbus_g_method_return_error (context, &e);
+    }
 }
 
 void
-- 
1.5.6.5




More information about the telepathy-commits mailing list