[telepathy-gabble/master] Let terminated_cb actually remove the member.

Will Thompson will.thompson at collabora.co.uk
Thu Mar 19 07:57:09 PDT 2009


Also, don't set CanAdd on the channel when we've just removed the peer:
we don't actually support adding in that context.
---
 src/media-channel.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index d2ccb49..d5c043f 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -1984,7 +1984,6 @@ gabble_media_channel_remove_member (GObject *obj,
   GabbleMediaChannel *chan = GABBLE_MEDIA_CHANNEL (obj);
   GabbleMediaChannelPrivate *priv = chan->priv;
   TpGroupMixin *mixin = TP_GROUP_MIXIN (obj);
-  TpIntSet *set;
 
   if (priv->session == NULL)
     {
@@ -2004,20 +2003,13 @@ gabble_media_channel_remove_member (GObject *obj,
       return FALSE;
     }
 
-  gabble_jingle_session_terminate (priv->session);
-
-  /* remove the member */
-  set = tp_intset_new ();
-  tp_intset_add (set, handle);
-
-  tp_group_mixin_change_members (obj, "", NULL, set, NULL, NULL, 0, 0);
-
-  tp_intset_destroy (set);
-
-  /* and update flags accordingly */
-  tp_group_mixin_change_flags (obj, TP_CHANNEL_GROUP_FLAG_CAN_ADD,
+  /* We're terminating the session, any further changes to the members are
+   * meaningless, since the channel will go away RSN. */
+  tp_group_mixin_change_flags (obj, 0,
       TP_CHANNEL_GROUP_FLAG_CAN_REMOVE | TP_CHANNEL_GROUP_FLAG_CAN_RESCIND);
 
+  gabble_jingle_session_terminate (priv->session);
+
   return TRUE;
 }
 
@@ -2056,10 +2048,13 @@ session_terminated_cb (GabbleJingleSession *session,
   tp_group_mixin_change_members ((GObject *) channel,
       "", NULL, set, NULL, NULL, terminator, reason);
 
-  /* update flags accordingly -- allow adding, deny removal */
-  tp_group_mixin_change_flags ((GObject *) channel,
-      TP_CHANNEL_GROUP_FLAG_CAN_ADD,
-      TP_CHANNEL_GROUP_FLAG_CAN_REMOVE);
+  /* update flags accordingly -- no operations are meaningful any more, because
+   * the channel is about to close.
+   */
+  tp_group_mixin_change_flags ((GObject *) channel, 0,
+      TP_CHANNEL_GROUP_FLAG_CAN_ADD |
+      TP_CHANNEL_GROUP_FLAG_CAN_REMOVE |
+      TP_CHANNEL_GROUP_FLAG_CAN_RESCIND);
 
   /* Ignore any Google relay session responses we're waiting for. */
   g_list_foreach (priv->stream_creation_datas, stream_creation_data_cancel,
-- 
1.5.6.5




More information about the telepathy-commits mailing list