[Telepathy-commits] [telepathy-gabble/master] Accept local pending sends when accepting a call

Will Thompson will.thompson at collabora.co.uk
Thu Feb 19 10:06:55 PST 2009


This hasn't been done since the jingle refactoring, but was masked by
the bug fixed in 45ff4fc8593a8 whereby streams were bidirectional by
default.
---
 src/media-channel.c |    4 ++++
 src/media-stream.c  |   22 ++++++++++++++++++++++
 src/media-stream.h  |    1 +
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index c727bba..62069a8 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -1821,6 +1821,10 @@ _gabble_media_channel_add_member (GObject *obj,
           tp_group_mixin_change_flags (obj,
               0, TP_CHANNEL_GROUP_FLAG_CAN_ADD);
 
+          /* accept any local pending sends */
+          g_ptr_array_foreach (priv->streams,
+              (GFunc) gabble_media_stream_accept_pending_local_send, NULL);
+
           /* signal acceptance */
           gabble_jingle_session_accept (priv->session);
 
diff --git a/src/media-stream.c b/src/media-stream.c
index 2ae1fc6..ee0b661 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -1515,6 +1515,28 @@ gabble_media_stream_change_direction (GabbleMediaStream *stream,
   return TRUE;
 }
 
+void
+gabble_media_stream_accept_pending_local_send (GabbleMediaStream *stream)
+{
+  CombinedStreamDirection combined_dir = stream->combined_direction;
+  TpMediaStreamDirection current_dir;
+  TpMediaStreamPendingSend pending_send;
+
+  current_dir = COMBINED_DIRECTION_GET_DIRECTION (combined_dir);
+  pending_send = COMBINED_DIRECTION_GET_PENDING_SEND (combined_dir);
+
+  if ((pending_send & TP_MEDIA_STREAM_PENDING_LOCAL_SEND) != 0)
+    {
+      DEBUG ("accepting pending local send on stream %s", stream->name);
+
+      gabble_media_stream_change_direction (stream,
+          current_dir | TP_MEDIA_STREAM_DIRECTION_SEND, NULL);
+    }
+  else
+    {
+      DEBUG ("stream %s not pending local send", stream->name);
+    }
+}
 
 static void
 update_sending (GabbleMediaStream *stream, gboolean start_sending)
diff --git a/src/media-stream.h b/src/media-stream.h
index 3b23953..5a2a594 100644
--- a/src/media-stream.h
+++ b/src/media-stream.h
@@ -92,6 +92,7 @@ void _gabble_media_stream_close (GabbleMediaStream *close);
 void gabble_media_stream_hold (GabbleMediaStream *stream, gboolean hold);
 gboolean gabble_media_stream_change_direction (GabbleMediaStream *stream,
     guint requested_dir, GError **error);
+void gabble_media_stream_accept_pending_local_send (GabbleMediaStream *stream);
 
 G_END_DECLS
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list