[folks] Don't warn when adding an existing contact.



commit c0dfe5895ff6f04aaa81d067d324349563d8ad2c
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Aug 2 16:57:28 2010 +0100

    Don't warn when adding an existing contact.
    
    Closes bgo#625830

 backends/telepathy/tpf-persona-store.vala |    6 ++++--
 folks/individual-aggregator.vala          |    2 +-
 folks/persona-store.vala                  |    3 +++
 3 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/backends/telepathy/tpf-persona-store.vala b/backends/telepathy/tpf-persona-store.vala
index 650867a..ba6779a 100644
--- a/backends/telepathy/tpf-persona-store.vala
+++ b/backends/telepathy/tpf-persona-store.vala
@@ -1090,10 +1090,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
               return persona;
             }
-          else
+          else if (personas != null && personas.length () > 1)
             {
+              /* We ignore the case of an empty list, as it just means the
+               * contact was already in our roster */
               warning ("requested a single persona, but got %u back",
-                  personas == null ? 0 : personas.length ());
+                  personas.length ());
             }
         }
       catch (GLib.Error e)
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 5d602a3..8557de7 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -288,7 +288,7 @@ public class Folks.IndividualAggregator : Object
               persona_store_type, persona_store_id, e.message);
         }
 
-      if (parent != null)
+      if (parent != null && persona != null)
         {
           var personas = parent.personas.copy ();
 
diff --git a/folks/persona-store.vala b/folks/persona-store.vala
index 42df206..ec5db71 100644
--- a/folks/persona-store.vala
+++ b/folks/persona-store.vala
@@ -126,6 +126,9 @@ public abstract class Folks.PersonaStore : Object
    * If the details are not recognised or are invalid,
    * { link PersonaStoreError.INVALID_ARGUMENT} will be thrown.
    *
+   * If a { link Persona} with the given details already exists in the store,
+   * `null` will be returned, but no error will be thrown.
+   *
    * @param details a key-value map of details to use in creating the new
    * { link Persona}
    * @return the new { link Persona}, or `null` on failure



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