Expose new posts and replies from the notifications.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 24 Nov 2010 10:41:14 +0000 (11:41 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 24 Nov 2010 10:41:14 +0000 (11:41 +0100)
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index feeab46..1c91b64 100644 (file)
@@ -23,7 +23,9 @@ import java.io.Reader;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -218,6 +220,26 @@ public class WebInterface implements CoreListener {
                return formPassword;
        }
 
+       /**
+        * Returns the posts that have been announced as new in the
+        * {@link #newPostNotification}.
+        *
+        * @return The new posts
+        */
+       public Set<Post> getNewPosts() {
+               return new HashSet<Post>(newPostNotification.getElements());
+       }
+
+       /**
+        * Returns the replies that have been announced as new in the
+        * {@link #newReplyNotification}.
+        *
+        * @return The new replies
+        */
+       public Set<Reply> getNewReplies() {
+               return new HashSet<Reply>(newReplyNotification.getElements());
+       }
+
        //
        // ACTIONS
        //