From f805b2f9b5f27295038f59decee10c7e43294632 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 17 Jan 2011 10:38:18 +0100 Subject: [PATCH] Add method to mark a Sone as known. --- src/main/java/net/pterodactylus/sone/core/Core.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 3ebdb59..8cf8834 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -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. * -- 2.7.4