]> git.0d.be Git - empathy.git/commitdiff
use tpf_persona_dup_for_contact() instead of lookup_by_contact()
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 28 Mar 2012 13:54:45 +0000 (15:54 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 2 Apr 2012 07:28:47 +0000 (09:28 +0200)
No need to iterate over all the individuals any more.

libempathy/empathy-utils.c

index 5730ed555cdc0c1fa4a5a2dccc3f6af6b0842fa8..62c6544287d9ef037c049f5d2538e7f91e03c875 100644 (file)
@@ -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;
 }