Add enum for possible “show custom avatars” option values.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index ca970c2..901d676 100644 (file)
@@ -47,6 +47,30 @@ import freenet.keys.FreenetURI;
  */
 public class Sone implements Fingerprintable, Comparable<Sone> {
 
+       /**
+        * The possible values for the “show custom avatars” option.
+        *
+        * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+        */
+       public static enum ShowCustomAvatars {
+
+               /** Never show custom avatars. */
+               NEVER,
+
+               /** Only show custom avatars of followed Sones. */
+               FOLLOWED,
+
+               /** Only show custom avatars of Sones you manually trust. */
+               MANUALLY_TRUSTED,
+
+               /** Only show custom avatars of automatically trusted Sones. */
+               TRUSTED,
+
+               /** Always show custom avatars. */
+               ALWAYS,
+
+       }
+
        /** comparator that sorts Sones by their nice name. */
        public static final Comparator<Sone> NICE_NAME_COMPARATOR = new Comparator<Sone>() {
 
@@ -115,6 +139,15 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
 
        };
 
+       /** Filter that matches Sones that have at least one album. */
+       public static final Filter<Sone> HAS_ALBUM_FILTER = new Filter<Sone>() {
+
+               @Override
+               public boolean filterObject(Sone sone) {
+                       return !sone.getAlbums().isEmpty();
+               }
+       };
+
        /** The logger. */
        private static final Logger logger = Logging.getLogger(Sone.class);
 
@@ -138,7 +171,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
        private volatile long time;
 
        /** The profile of this Sone. */
-       private volatile Profile profile = new Profile();
+       private volatile Profile profile = new Profile(this);
 
        /** The client used by the Sone. */
        private volatile Client client;
@@ -380,19 +413,6 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
        }
 
        /**
-        * Sets all friends of this Sone at once.
-        *
-        * @param friends
-        *            The new (and only) friends of this Sone
-        * @return This Sone (for method chaining)
-        */
-       public Sone setFriends(Collection<String> friends) {
-               friendSones.clear();
-               friendSones.addAll(friends);
-               return this;
-       }
-
-       /**
         * Returns whether this Sone has the given Sone as a friend Sone.
         *
         * @param friendSoneId