From c03a4ced3dd1562f4387edb449680a6fd8b9a746 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 28 Jan 2012 23:50:14 +0100 Subject: [PATCH] Initialize known-state of posts and replies correctly. --- src/main/java/net/pterodactylus/sone/core/Core.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index e94924c..108b05c 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1168,15 +1168,13 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis List storedPosts = storedSone.getPosts(); synchronized (knownPosts) { for (Post post : sone.getPosts()) { - post.setSone(storedSone); + post.setSone(storedSone).setKnown(knownPosts.contains(post.getId())); if (!storedPosts.contains(post)) { if (post.getTime() < getSoneFollowingTime(sone)) { - sone.setKnown(true); knownPosts.add(post.getId()); } else if (!knownPosts.contains(post.getId())) { + sone.setKnown(false); coreListenerManager.fireNewPostFound(post); - } else { - sone.setKnown(true); } } posts.put(post.getId(), post); @@ -1195,15 +1193,13 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis Set storedReplies = storedSone.getReplies(); synchronized (knownReplies) { for (PostReply reply : sone.getReplies()) { - reply.setSone(storedSone); + reply.setSone(storedSone).setKnown(knownReplies.contains(reply.getId())); if (!storedReplies.contains(reply)) { if (reply.getTime() < getSoneFollowingTime(sone)) { - reply.setKnown(true); knownReplies.add(reply.getId()); } else if (!knownReplies.contains(reply.getId())) { + reply.setKnown(false); coreListenerManager.fireNewReplyFound(reply); - } else { - reply.setKnown(true); } } replies.put(reply.getId(), reply); -- 2.7.4