[Telepathy-commits] [telepathy-gabble/master] replace gabble_bytestream_multiple_count_stream_method by gabble_bytestream_multiple_has_stream_method

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


---
 src/bytestream-factory.c  |    4 ++--
 src/bytestream-multiple.c |    9 ++++++---
 src/bytestream-multiple.h |    2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index 1c40f70..dd78815 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -684,8 +684,8 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler,
   if (multiple)
     {
       /* Is there at least one stream method? */
-      if (gabble_bytestream_multiple_count_stream_method (
-            GABBLE_BYTESTREAM_MULTIPLE (bytestream)) == 0)
+      if (!gabble_bytestream_multiple_has_stream_method (
+            GABBLE_BYTESTREAM_MULTIPLE (bytestream)))
         {
           GError e = { GABBLE_XMPP_ERROR, XMPP_ERROR_SI_NO_VALID_STREAMS, "" };
           DEBUG ("No valid stream method in the multi bytestream. Closing");
diff --git a/src/bytestream-multiple.c b/src/bytestream-multiple.c
index 19b865a..7ab143d 100644
--- a/src/bytestream-multiple.c
+++ b/src/bytestream-multiple.c
@@ -615,13 +615,16 @@ gabble_bytestream_multiple_add_stream_method (GabbleBytestreamMultiple *self,
     bytestream_activate_next (self);
 }
 
-guint
-gabble_bytestream_multiple_count_stream_method (GabbleBytestreamMultiple *self)
+gboolean
+gabble_bytestream_multiple_has_stream_method (GabbleBytestreamMultiple *self)
 {
   GabbleBytestreamMultiplePrivate *priv =
     GABBLE_BYTESTREAM_MULTIPLE_GET_PRIVATE (self);
 
-  return g_list_length (priv->fallback_stream_methods);
+  if (priv->active_bytestream != NULL)
+    return TRUE;
+
+  return (g_list_length (priv->fallback_stream_methods) != 0);
 }
 
 static void
diff --git a/src/bytestream-multiple.h b/src/bytestream-multiple.h
index 660333e..89da446 100644
--- a/src/bytestream-multiple.h
+++ b/src/bytestream-multiple.h
@@ -68,7 +68,7 @@ GType gabble_bytestream_multiple_get_type (void);
 void gabble_bytestream_multiple_add_stream_method (
     GabbleBytestreamMultiple *self, const gchar *method);
 
-guint gabble_bytestream_multiple_count_stream_method (
+gboolean gabble_bytestream_multiple_has_stream_method (
     GabbleBytestreamMultiple *self);
 
 G_END_DECLS
-- 
1.5.6.5




More information about the Telepathy-commits mailing list