aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-14 20:16:23 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-31 16:39:40 +0800
commit821a05da92cf42b7d3971500575375e3f0308866 (patch)
treec6cf393b40dc672c17e1ef4cbe2c51b6a8172c77
parent9a36a55fb92e7f0a0c92a9c04c4d02215af7a4b6 (diff)
downloadgsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.tar
gsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.tar.gz
gsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.tar.bz2
gsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.tar.lz
gsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.tar.xz
gsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.tar.zst
gsoc2013-empathy-821a05da92cf42b7d3971500575375e3f0308866.zip
add members of 'publish' as members of the TpContactList
-rw-r--r--libempathy/empathy-tp-contact-list.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index b458e1d90..8b35f2745 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -49,8 +49,11 @@ typedef struct {
TpChannel *stored;
/* contact handle (TpHandle) => reffed (EmpathyContact *)
*
- * Contacts which are members or remote-pending in the subscribe channel:
- * we are receiving their presence or we asked to receive it. */
+ * Union of:
+ * - members of 'subscribe': we receive their presence
+ * - RP of 'subscribe': we asked to receive their presence
+ * - members of 'publish': we send them our presence
+ */
GHashTable *members;
/* contact handle (TpHandle) => reffed (EmpathyContact *)
*
@@ -509,7 +512,21 @@ static void
remove_from_member_if_needed (EmpathyTpContactList *list,
TpHandle handle)
{
+ /* remove contact from members if it's not in publish and subscribe */
EmpathyTpContactListPriv *priv = GET_PRIV (list);
+ const TpIntSet *members;
+
+ members = tp_channel_group_get_members (priv->subscribe);
+ if (tp_intset_is_member (members, handle))
+ return;
+
+ members = tp_channel_group_get_remote_pending (priv->subscribe);
+ if (tp_intset_is_member (members, handle))
+ return;
+
+ members = tp_channel_group_get_members (priv->publish);
+ if (tp_intset_is_member (members, handle))
+ return;
tp_contact_list_remove_handle (list, priv->members, handle);
}
@@ -529,6 +546,7 @@ tp_contact_list_publish_group_members_changed_cb (TpChannel *channel,
guint i;
/* We now send our presence to those contacts, remove them from pendings */
+ add_to_members (list, added);
for (i = 0; i < added->len; i++) {
tp_contact_list_remove_handle (list, priv->pendings,
g_array_index (added, TpHandle, i));
@@ -536,8 +554,10 @@ tp_contact_list_publish_group_members_changed_cb (TpChannel *channel,
/* We refuse to send our presence to those contacts, remove from pendings */
for (i = 0; i < removed->len; i++) {
- tp_contact_list_remove_handle (list, priv->pendings,
- g_array_index (removed, TpHandle, i));
+ TpHandle handle = g_array_index (removed, TpHandle, i);
+
+ tp_contact_list_remove_handle (list, priv->pendings, handle);
+ remove_from_member_if_needed (list, handle);
}
/* Those contacts want our presence, auto accept those that are already