[empathy] use tpf_persona_dup_for_contact() instead of lookup_by_contact()



commit 7b79bb85f4ff7693ba24c8a94cdcfd9889b567bd
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Mar 28 15:54:45 2012 +0200

    use tpf_persona_dup_for_contact() instead of lookup_by_contact()
    
    No need to iterate over all the individuals any more.

 libempathy/empathy-utils.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 5730ed5..62c6544 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -1211,17 +1211,24 @@ empathy_create_individual_from_tp_contact (TpContact *contact)
 FolksIndividual *
 empathy_ensure_individual_from_tp_contact (TpContact *contact)
 {
-  EmpathyIndividualManager *mgr;
+  TpfPersona *persona;
   FolksIndividual *individual;
 
-  mgr = empathy_individual_manager_dup_singleton ();
-  individual = empathy_individual_manager_lookup_by_contact (mgr, contact);
+  persona = tpf_persona_dup_for_contact (contact);
+  if (persona == NULL)
+    {
+      DEBUG ("Failed to get a persona for %s",
+          tp_contact_get_identifier (contact));
+      return NULL;
+    }
+
+  individual = folks_persona_get_individual (FOLKS_PERSONA (persona));
 
   if (individual != NULL)
     g_object_ref (individual);
   else
-    individual = empathy_create_individual_from_tp_contact (contact);
+    individual = create_individual_from_persona (FOLKS_PERSONA (persona));
 
-  g_object_unref (mgr);
+  g_object_unref (persona);
   return individual;
 }



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