[Telepathy-commits] [telepathy-gabble/master] bytestream_factory_iq_si_cb: check if the multi bytestreams contains at least one stream method

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue Jan 6 08:41:35 PST 2009


---
 src/bytestream-factory.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index e6574f2..15a697b 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -657,8 +657,6 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler,
         }
     }
 
-  /* FIXME check if there are bytestream methods in the multiple one */
-
   if (bytestream == NULL)
     {
       DEBUG ("SI request doesn't contain any supported stream methods.");
@@ -668,6 +666,20 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler,
       goto out;
     }
 
+  if (multiple)
+    {
+      /* Is there at least one stream method? */
+      if (gabble_bytestream_multiple_nb_stream_method (
+            GABBLE_BYTESTREAM_MULTIPLE (bytestream)) == 0)
+        {
+          GError e = { GABBLE_XMPP_ERROR, XMPP_ERROR_SI_NO_VALID_STREAMS, "" };
+          DEBUG ("No valid stream method in the multi bytestream. Closing");
+
+          gabble_bytestream_iface_close (bytestream, &e);
+          goto out;
+        }
+    }
+
   /* Now that we have a bytestream, it's responsible for declining the IQ
    * if needed. */
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list