[Telepathy-commits] [telepathy-glib/master] Channel: don't allow handle 0 to be in a group, even if the CM says it is
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Feb 4 08:25:46 PST 2009
That would just cause confusion, and is clearly wrong.
---
telepathy-glib/channel-group.c | 57 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/telepathy-glib/channel-group.c b/telepathy-glib/channel-group.c
index fccbd3d..966ce59 100644
--- a/telepathy-glib/channel-group.c
+++ b/telepathy-glib/channel-group.c
@@ -536,6 +536,12 @@ _tp_channel_group_set_lp (TpChannel *self,
item->values + 2);
const gchar *message = g_value_get_string (item->values + 3);
+ if (handle == 0)
+ {
+ DEBUG ("Ignoring handle 0, claimed to be in local-pending");
+ continue;
+ }
+
DEBUG ("+L %u, actor=%u, reason=%u, message=%s", handle,
actor, reason, message);
_tp_channel_group_set_one_lp (self, handle, actor,
@@ -567,6 +573,21 @@ tp_channel_got_all_members_0_16_cb (TpChannel *self,
self->priv->group_members = tp_intset_from_array (members);
self->priv->group_remote_pending = tp_intset_from_array (remote_pending);
+ if (tp_intset_remove (self->priv->group_members, 0))
+ {
+ DEBUG ("Ignoring handle 0, claimed to be in group");
+ }
+
+ if (tp_intset_remove (self->priv->group_local_pending, 0))
+ {
+ DEBUG ("Ignoring handle 0, claimed to be in local-pending");
+ }
+
+ if (tp_intset_remove (self->priv->group_remote_pending, 0))
+ {
+ DEBUG ("Ignoring handle 0, claimed to be in remote-pending");
+ }
+
/* the local-pending info will be filled in with the result of
* GetLocalPendingMembersWithInfo, if it succeeds */
}
@@ -715,6 +736,11 @@ tp_channel_got_group_properties_cb (TpProxy *proxy,
else
self->priv->group_members = tp_intset_from_array (arr);
+ if (tp_intset_remove (self->priv->group_members, 0))
+ {
+ DEBUG ("Ignoring handle 0, claimed to be in group");
+ }
+
arr = tp_asv_get_boxed (asv, "RemotePendingMembers", au_type);
if (arr == NULL)
@@ -722,6 +748,11 @@ tp_channel_got_group_properties_cb (TpProxy *proxy,
else
self->priv->group_remote_pending = tp_intset_from_array (arr);
+ if (tp_intset_remove (self->priv->group_remote_pending, 0))
+ {
+ DEBUG ("Ignoring handle 0, claimed to be in remote-pending");
+ }
+
g_assert (self->priv->group_local_pending == NULL);
g_assert (self->priv->group_local_pending_info == NULL);
@@ -801,6 +832,13 @@ handle_members_changed (TpChannel *self,
TpHandle handle = g_array_index (added, guint, i);
DEBUG ("+++ contact#%u", handle);
+
+ if (handle == 0)
+ {
+ DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring");
+ continue;
+ }
+
tp_intset_add (self->priv->group_members, handle);
}
@@ -810,6 +848,12 @@ handle_members_changed (TpChannel *self,
DEBUG ("+LP contact#%u", handle);
+ if (handle == 0)
+ {
+ DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring");
+ continue;
+ }
+
/* Special-case renaming a local-pending contact, if the
* signal is spec-compliant. Keep the old actor/reason/message in
* this case */
@@ -843,6 +887,13 @@ handle_members_changed (TpChannel *self,
TpHandle handle = g_array_index (remote_pending, guint, i);
DEBUG ("+RP contact#%u", handle);
+
+ if (handle == 0)
+ {
+ DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring");
+ continue;
+ }
+
tp_intset_add (self->priv->group_remote_pending, handle);
}
@@ -852,6 +903,12 @@ handle_members_changed (TpChannel *self,
DEBUG ("--- contact#%u", handle);
+ if (handle == 0)
+ {
+ DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring");
+ continue;
+ }
+
if (self->priv->group_local_pending_info != NULL)
g_hash_table_remove (self->priv->group_local_pending_info,
GUINT_TO_POINTER (handle));
--
1.5.6.5
More information about the telepathy-commits
mailing list