]> git.0d.be Git - empathy.git/commitdiff
Auto-accept to publish presence to contacts that are in our subscribe
authorXavier Claessens <xclaesse@gmail.com>
Thu, 12 Jul 2007 13:23:09 +0000 (13:23 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Thu, 12 Jul 2007 13:23:09 +0000 (13:23 +0000)
2007-07-12 Xavier Claessens  <xclaesse@gmail.com>

* 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

index dd04fac53d565bfac37fee26b54680ca68845db9..213e5c6ba489da5e64e811e98ec0aaca20e9d23f 100644 (file)
@@ -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)) {