[folks] Ensure untrusted Personas' Individuals are signalled as removed



commit 9184070a8450d1a1707245c144d3341f241c6686
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Aug 30 11:50:58 2010 +0100

    Ensure untrusted Personas' Individuals are signalled as removed
    
    When a Persona from an untrusted PersonaStore (such as link-local XMPP) was
    removed, the Individual which contained (only) that Persona was not being
    signalled as removed, causing link-local XMPP contacts to (for example) remain
    in Empathy's contact list even after going offline. Closes: bgo#628305

 folks/individual-aggregator.vala |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 0b6b0cf..4a30d6e 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -239,7 +239,8 @@ public class Folks.IndividualAggregator : Object
           if (trust_level != PersonaStoreTrust.NONE)
             {
               Individual candidate_ind = this.link_map.lookup (persona.iid);
-              if (candidate_ind != null)
+              if (candidate_ind != null &&
+                  candidate_ind.trust_level != TrustLevel.NONE)
                 {
                   debug ("    Found candidate individual '%s' by IID '%s'.",
                       candidate_ind.id, persona.iid);
@@ -274,6 +275,7 @@ public class Folks.IndividualAggregator : Object
                           this.link_map.lookup (prop_linking_value);
 
                       if (candidate_ind != null &&
+                          candidate_ind.trust_level != TrustLevel.NONE &&
                           !candidate_ind_set.contains (candidate_ind))
                         {
                           debug ("    Found candidate individual '%s' by " +
@@ -329,9 +331,11 @@ public class Folks.IndividualAggregator : Object
 
               debug ("        %s (%s)", final_persona.uid, final_persona.iid);
 
-              /* Only add the Persona to the link map if we trust its IID. */
-              if (trust_level != PersonaStoreTrust.NONE)
-                this.link_map.replace (final_persona.iid, final_individual);
+              /* Add the Persona to the link map. Its trust level will be
+               * reflected in final_individual.trust_level, so other Personas
+               * won't be linked against it in error if the trust level is
+               * NONE. */
+              this.link_map.replace (final_persona.iid, final_individual);
 
               /* Only allow linking on non-IID properties of the Persona if we
                * fully trust the PersonaStore it came from. */
@@ -413,12 +417,12 @@ public class Folks.IndividualAggregator : Object
            * eliminate them from the list of Personas to relink, below. */
           removed_personas.add (persona);
 
-          if (trust_level != PersonaStoreTrust.NONE)
-            {
-              Individual ind = this.link_map.lookup (persona.iid);
-              removed_individuals.prepend (ind);
-              this.link_map.remove (persona.iid);
-            }
+          /* Find the Individual containing the Persona and mark them for
+           * removal (any other Personas they have which aren't being removed
+           * will be re-linked into other Individuals). */
+          Individual ind = this.link_map.lookup (persona.iid);
+          removed_individuals.prepend (ind);
+          this.link_map.remove (persona.iid);
 
           if (trust_level == PersonaStoreTrust.FULL)
             {



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