Mark own posts as read immediately.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index 841f560..37d1741 100644 (file)
@@ -113,6 +113,9 @@ public class Core implements IdentityListener {
        /* synchronize access on {@link #newSones}. */
        private Set<String> knownSones = new HashSet<String>();
 
+       /** All posts. */
+       private Map<String, Post> posts = new HashMap<String, Post>();
+
        /** All new posts. */
        private Set<String> newPosts = new HashSet<String>();
 
@@ -120,9 +123,6 @@ public class Core implements IdentityListener {
        /* synchronize access on {@link #newPosts}. */
        private Set<String> knownPosts = new HashSet<String>();
 
-       /** All posts. */
-       private Map<String, Post> posts = new HashMap<String, Post>();
-
        /** All replies. */
        private Map<String, Reply> replies = new HashMap<String, Reply>();
 
@@ -933,6 +933,9 @@ public class Core implements IdentityListener {
                synchronized (posts) {
                        posts.put(post.getId(), post);
                }
+               synchronized (newPosts) {
+                       knownPosts.add(post.getId());
+               }
                sone.addPost(post);
                saveSone(sone);
        }