}
sone.setLatestEdition(Numbers.safeParseLong(ownIdentity.getProperty("Sone.LatestEdition"), (long) 0));
sone.setClient(new Client("Sone", SonePlugin.VERSION.toString()));
+ sone.setKnown(true);
/* TODO - load posts ’n stuff */
localSones.put(ownIdentity.getId(), sone);
final SoneInserter soneInserter = new SoneInserter(this, freenetInterface, sone);
List<Post> 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);
Set<PostReply> 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);
}
/**
- * Marks the given Sone as known. If the Sone was {@link #isNewPost(String)
- * new} before, a {@link CoreListener#markSoneKnown(Sone)} event is fired.
+ * Marks the given Sone as known. If the Sone was not {@link Post#isKnown()
+ * known} before, a {@link CoreListener#markSoneKnown(Sone)} event is fired.
*
* @param sone
* The Sone to mark as known
}
/**
- * Marks the given post as known, if it is currently a new post (according
- * to {@link #isNewPost(String)}).
+ * Marks the given post as known, if it is currently not a known post
+ * (according to {@link Post#isKnown()}).
*
* @param post
* The post to mark as known
public void markPostKnown(Post post) {
post.setKnown(true);
synchronized (knownPosts) {
+ coreListenerManager.fireMarkPostKnown(post);
if (knownPosts.add(post.getId())) {
- coreListenerManager.fireMarkPostKnown(post);
touchConfiguration();
}
}
+ for (PostReply reply : getReplies(post)) {
+ markReplyKnown(reply);
+ }
}
/**
}
/**
- * Marks the given reply as known, if it is currently a new reply (according
- * to {@link #isNewReply(String)}).
+ * Marks the given reply as known, if it is currently not a known reply
+ * (according to {@link Reply#isKnown()}).
*
* @param reply
* The reply to mark as known
public void markReplyKnown(PostReply reply) {
reply.setKnown(true);
synchronized (knownReplies) {
+ coreListenerManager.fireMarkReplyKnown(reply);
if (knownReplies.add(reply.getId())) {
- coreListenerManager.fireMarkReplyKnown(reply);
touchConfiguration();
}
}