Add method to mark a Sone as known.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 17 Jan 2011 09:38:18 +0000 (10:38 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 17 Jan 2011 09:38:18 +0000 (10:38 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 3ebdb59..8cf8834 100644 (file)
@@ -1125,6 +1125,23 @@ public class Core implements IdentityListener, UpdateListener {
        }
 
        /**
+        * Marks the given Sone as known. If the Sone was {@link #isNewPost(String)
+        * new} before, a {@link CoreListener#markSoneKnown(Sone)} event is fired.
+        *
+        * @param sone
+        *            The Sone to mark as known
+        */
+       public void markSoneKnown(Sone sone) {
+               synchronized (newSones) {
+                       if (newSones.remove(sone.getId())) {
+                               knownPosts.add(sone.getId());
+                               coreListenerManager.fireMarkSoneKnown(sone);
+                               saveConfiguration();
+                       }
+               }
+       }
+
+       /**
         * Loads and updates the given Sone from the configuration. If any error is
         * encountered, loading is aborted and the given Sone is not changed.
         *