[Telepathy-commits] [telepathy-gabble/master] GabbleMediaChannel: when session state changes to indicate we have contacted the peer, stuff them into remote-pending if they're not already there

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:51:58 PDT 2008


20080430154936-53eee-2d7aa01544e874bfe391180351a112118829755d.gz
---
 src/gabble-media-channel.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/gabble-media-channel.c b/src/gabble-media-channel.c
index a31f563..65c0c1d 100644
--- a/src/gabble-media-channel.c
+++ b/src/gabble-media-channel.c
@@ -1312,24 +1312,37 @@ session_state_changed_cb (GabbleMediaSession *session,
                 "peer", &peer,
                 NULL);
 
-  if (state != JS_STATE_ACTIVE)
-    return;
-
-  if (priv->creator != mixin->self_handle)
-    return;
-
   set = tp_intset_new ();
 
   /* add the peer to the member list */
   tp_intset_add (set, peer);
 
-  tp_group_mixin_change_members ((GObject *)channel,
-      "", set, NULL, NULL, NULL, 0, 0);
+  if (state >= JS_STATE_PENDING_INITIATE_SENT &&
+      state < JS_STATE_ACTIVE)
+    {
+      /* The first time we send anything to the other user, they materialise
+       * in remote-pending if necessary */
 
-  /* update flags accordingly -- allow removal, deny adding and rescinding */
-  tp_group_mixin_change_flags ((GObject *)channel,
-      TP_CHANNEL_GROUP_FLAG_CAN_REMOVE,
-      TP_CHANNEL_GROUP_FLAG_CAN_ADD | TP_CHANNEL_GROUP_FLAG_CAN_RESCIND);
+      tp_group_mixin_change_members ((GObject *) channel,
+          "", NULL, NULL, NULL, set, 0, 0);
+
+      tp_group_mixin_change_flags ((GObject *) channel,
+          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE | TP_CHANNEL_GROUP_FLAG_CAN_RESCIND,
+          TP_CHANNEL_GROUP_FLAG_CAN_ADD);
+    }
+
+  if (state == JS_STATE_ACTIVE &&
+      priv->creator == mixin->self_handle)
+    {
+      tp_group_mixin_change_members ((GObject *)channel,
+          "", set, NULL, NULL, NULL, 0, 0);
+
+      /* update flags accordingly -- allow removal, deny adding and
+       * rescinding */
+      tp_group_mixin_change_flags ((GObject *) channel,
+          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE,
+          TP_CHANNEL_GROUP_FLAG_CAN_ADD | TP_CHANNEL_GROUP_FLAG_CAN_RESCIND);
+    }
 
   tp_intset_destroy (set);
 }
-- 
1.5.6.3




More information about the Telepathy-commits mailing list