[folks] create_personas_from_contact_ids: always return all the personas



commit 7df672ddcd782a314745c998d1aa566a2a02f06d
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Mar 22 15:34:15 2012 +0100

    create_personas_from_contact_ids: always return all the personas
    
    We always want to try adding the persona to Telepathy, even if it was already
    existing in Folks because, for example, we look for the details of this
    contact before adding it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671714

 NEWS                                          |    1 +
 backends/telepathy/lib/tpf-persona-store.vala |   13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 737cc35..6cdf0bc 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Bugs fixed:
 * Bug 670347 â Check for null birthday strings
 * Bug 661490 â Should mark contacts from the "Starred in Android" group as
   Favorites
+* Bug 671714 â Fail to add contact to the contact list
 
 Overview of changes from libfolks 0.6.6 to libfolks 0.6.7
 =============================================================
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index e755fee..b0a8d25 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -1951,10 +1951,11 @@ public class Tpf.PersonaStore : Folks.PersonaStore
         }
     }
 
-  private async HashSet<Persona> _create_personas_from_contact_ids (
+  private async HashSet<Persona> _ensure_personas_from_contact_ids (
       string[] contact_ids) throws GLib.Error
     {
       var personas = new HashSet<Persona> ();
+      var personas_added = new HashSet<Persona> ();
 
       if (contact_ids.length == 0)
         return personas;
@@ -1973,12 +1974,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
           bool added;
           var persona = this._add_persona_from_contact (contact, true, out added);
           if (added)
-            personas.add (persona);
+            personas_added.add (persona);
+
+          personas.add (persona);
         }
 
-      if (personas.size > 0)
+      if (personas_added.size > 0)
         {
-          this._emit_personas_changed (personas, null);
+          this._emit_personas_changed (personas_added, null);
         }
 
       return personas;
@@ -2212,7 +2215,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
       try
         {
-          var personas = yield this._create_personas_from_contact_ids (
+          var personas = yield this._ensure_personas_from_contact_ids (
               contact_ids);
 
           if (personas.size == 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]