[folks] Bug 627968 — Add Individual.trust_level property
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Bug 627968 — Add Individual.trust_level property
- Date: Thu, 26 Aug 2010 18:32:12 +0000 (UTC)
commit db4f574a00273779a7e369dfedc6da02a1b1eaae
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Aug 25 19:00:37 2010 +0100
Bug 627968 â?? Add Individual.trust_level property
Add a property to indicate how far the Individual should be trusted. This
is NONE if any of the Individual's Personas come from a non-trusted
PersonaStore. Closes: bgo#627968
folks/individual.vala | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/folks/individual.vala b/folks/individual.vala
index a3515c6..9ef912e 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -23,6 +23,43 @@ using GLib;
using Folks;
/**
+ * Trust level for an { link Individual} for use in the UI.
+ *
+ * @since 0.1.16
+ */
+public enum Folks.TrustLevel
+{
+ /**
+ * The { link Individual}'s { link Persona}s aren't trusted at all.
+ *
+ * This is the trust level for an { link Individual} which contains one or
+ * more { link Persona}s which cannot be guaranteed to be the same
+ * { link Persona}s as were originally linked together.
+ *
+ * For example, an { link Individual} containing a link-local XMPP
+ * { link Persona} would have this trust level, since someone else could
+ * easily spoof the link-local XMPP { link Persona}'s identity.
+ *
+ * @since 0.1.16
+ */
+ NONE,
+
+ /**
+ * The { link Individual}'s { link Persona}s are trusted.
+ *
+ * This trust level is for { link Individual}s where it can be guaranteed
+ * that all the { link Persona}s are the same ones as when they were
+ * originally linked together.
+ *
+ * Note that this doesn't guarantee that the user who behind each
+ * { link Persona} is who they claim to be.
+ *
+ * @since 0.1.16
+ */
+ PERSONAS
+}
+
+/**
* A physical person, aggregated from the various { link Persona}s the person
* might have, such as their different IM addresses or vCard entries.
*/
@@ -50,6 +87,19 @@ public class Folks.Individual : Object,
private HashMap<PersonaStore, uint> stores;
/**
+ * The trust level of the Individual.
+ *
+ * This specifies how far the Individual can be trusted to be who it claims
+ * to be. See the descriptions for the elements of { link TrustLevel}.
+ *
+ * Clients should ''not'' allow linking of Individuals who have a trust level
+ * of { link TrustLevel.NONE}.
+ *
+ * @since 0.1.16
+ */
+ public TrustLevel trust_level { get; private set; }
+
+ /**
* { inheritDoc}
*/
public File avatar { get; private set; }
@@ -315,6 +365,7 @@ public class Folks.Individual : Object,
this.update_is_favourite ();
this.update_avatar ();
this.update_alias ();
+ this.update_trust_level ();
}
private void update_groups ()
@@ -489,6 +540,21 @@ public class Folks.Individual : Object,
this.avatar = avatar;
}
+ private void update_trust_level ()
+ {
+ TrustLevel trust_level = TrustLevel.PERSONAS;
+
+ foreach (Persona p in this._persona_list)
+ {
+ if (p.store.trust_level == PersonaStoreTrust.NONE)
+ trust_level = TrustLevel.NONE;
+ }
+
+ /* Only notify if the value has changed */
+ if (this.trust_level != trust_level)
+ this.trust_level = trust_level;
+ }
+
/*
* GLib/C convenience functions (for built-in casting, etc.)
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]