From 9dafc7dd9ac7da59e0b27581ea360f69e6097531 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 25 Nov 2010 12:14:21 +0100 Subject: [PATCH] Add methods to mark posts and replies as known. --- .../java/net/pterodactylus/sone/core/Core.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 0e7f163..3f2111a 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1203,6 +1203,22 @@ public class Core implements IdentityListener { } /** + * Marks the given post as known, if it is currently a new post (according + * to {@link #isNewPost(String)}). + * + * @param post + * The post to mark as known + */ + public void markPostKnown(Post post) { + synchronized (newPosts) { + if (newPosts.remove(post.getId())) { + knownPosts.add(post.getId()); + coreListenerManager.fireMarkPostKnown(post); + } + } + } + + /** * Creates a new reply. * * @param sone @@ -1252,6 +1268,22 @@ public class Core implements IdentityListener { } /** + * Marks the given reply as known, if it is currently a new reply (according + * to {@link #isNewReply(String)}). + * + * @param reply + * The reply to mark as known + */ + public void markReplyKnown(Reply reply) { + synchronized (newReplies) { + if (newReplies.remove(reply.getId())) { + knownReplies.add(reply.getId()); + coreListenerManager.fireMarkReplyKnown(reply); + } + } + } + + /** * Starts the core. */ public void start() { -- 2.7.4