[Telepathy-commits] [telepathy-gabble/master] media_stream_stream_state(): ignore illegal stream states

Senko Rasic senko at phyrexia.lan
Tue Dec 2 04:34:04 PST 2008


---
 src/media-stream.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/media-stream.c b/src/media-stream.c
index 209175c..ff3fc05 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -970,13 +970,25 @@ gabble_media_stream_stream_state (TpSvcMediaStreamHandler *iface,
 {
   GabbleMediaStream *self = GABBLE_MEDIA_STREAM (iface);
   GabbleMediaStreamPrivate *priv = GABBLE_MEDIA_STREAM_GET_PRIVATE (self);
+  JingleTransportState ts = JINGLE_TRANSPORT_STATE_DISCONNECTED;
 
-  g_object_set (self, "connection-state", connection_state, NULL);
+  switch (connection_state) {
+    case TP_MEDIA_STREAM_STATE_DISCONNECTED:
+      ts = JINGLE_TRANSPORT_STATE_DISCONNECTED;
+      break;
+    case TP_MEDIA_STREAM_STATE_CONNECTING:
+      ts = JINGLE_TRANSPORT_STATE_CONNECTING;
+      break;
+    case TP_MEDIA_STREAM_STATE_CONNECTED:
+      ts = JINGLE_TRANSPORT_STATE_CONNECTED;
+    default:
+      goto OUT;
+  }
 
-  /* FIXME: we're relying on 1:1 mapping between tp and jingle enums */
-  gabble_jingle_content_set_transport_state (priv->content,
-      connection_state);
+  g_object_set (self, "connection-state", connection_state, NULL);
+  gabble_jingle_content_set_transport_state (priv->content, ts);
 
+OUT:
   tp_svc_media_stream_handler_return_from_stream_state (context);
 }
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list