From 0083f8d68ad8e20d8d78a7bc800b62676d70648d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 12 Jul 2007 13:23:09 +0000 Subject: Auto-accept to publish presence to contacts that are in our subscribe 2007-07-12 Xavier Claessens * libempathy/empathy-tp-contact-list.c: Auto-accept to publish presence to contacts that are in our subscribe list. When accepting a pending contact add it to publish and subscribe list. svn path=/trunk/; revision=180 --- libempathy/empathy-tp-contact-list.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c index dd04fac53..213e5c6ba 100644 --- a/libempathy/empathy-tp-contact-list.c +++ b/libempathy/empathy-tp-contact-list.c @@ -535,6 +535,7 @@ tp_contact_list_process_pending (EmpathyContactList *list, handle = empathy_contact_get_handle (contact); if (accept) { empathy_tp_group_add_member (priv->publish, handle, NULL); + empathy_tp_group_add_member (priv->subscribe, handle, NULL); } else { empathy_tp_group_remove_member (priv->publish, handle, NULL); } @@ -1244,14 +1245,25 @@ tp_contact_list_pending_cb (EmpathyTpGroup *group, list_type); if (list_type == TP_CONTACT_LIST_TYPE_PUBLISH) { - EmpathyContactListInfo *info; - - info = empathy_contact_list_info_new (contact, message); - priv->local_pending = g_list_prepend (priv->local_pending, - info); - - g_signal_emit_by_name (list, "local-pending", - contact, message); + if (!g_list_find (priv->members, contact)) { + EmpathyContactListInfo *info; + + info = empathy_contact_list_info_new (contact, message); + priv->local_pending = g_list_prepend (priv->local_pending, + info); + + g_signal_emit_by_name (list, "local-pending", + contact, message); + } else { + guint handle; + + /* That contact wants our presence and he is + * in our roster. Accept to publish our presence + * without asking the user. */ + handle = empathy_contact_get_handle (contact); + empathy_tp_group_add_member (priv->publish, + handle, ""); + } } else if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE) { if (!g_list_find (priv->members, contact)) { -- cgit v1.2.3