Merge commit 'sone-removal-notification-200' into next
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 31 May 2011 19:12:23 +0000 (21:12 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 31 May 2011 19:12:23 +0000 (21:12 +0200)
This fixes #200.

src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/core/CoreListener.java
src/main/java/net/pterodactylus/sone/core/CoreListenerManager.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index 20852d2..1e68c63 100644 (file)
@@ -2037,6 +2037,7 @@ public class Core implements IdentityListener, UpdateListener {
                }
                synchronized (newSones) {
                        newSones.remove(identity.getId());
+                       coreListenerManager.fireSoneRemoved(sone);
                }
        }
 
index fb83c9f..d34ac36 100644 (file)
@@ -97,6 +97,14 @@ public interface CoreListener extends EventListener {
        public void markReplyKnown(Reply reply);
 
        /**
+        * Notifies a listener that the given Sone was removed.
+        *
+        * @param sone
+        *            The removed Sone
+        */
+       public void soneRemoved(Sone sone);
+
+       /**
         * Notifies a listener that the given post was removed.
         *
         * @param post
index 6dbdc58..786cfb8 100644 (file)
@@ -147,6 +147,19 @@ public class CoreListenerManager extends AbstractListenerManager<Core, CoreListe
        }
 
        /**
+        * Notifies all listener that the given Sone was removed.
+        *
+        * @see CoreListener#soneRemoved(Sone)
+        * @param sone
+        *            The removed Sone
+        */
+       void fireSoneRemoved(Sone sone) {
+               for (CoreListener coreListener : getListeners()) {
+                       coreListener.soneRemoved(sone);
+               }
+       }
+
+       /**
         * Notifies all listener that the given post was removed.
         *
         * @see CoreListener#postRemoved(Post)
index b4fffd9..98539fe 100644 (file)
@@ -745,6 +745,14 @@ public class WebInterface implements CoreListener {
         * {@inheritDoc}
         */
        @Override
+       public void soneRemoved(Sone sone) {
+               newSoneNotification.remove(sone);
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
        public void postRemoved(Post post) {
                newPostNotification.remove(post);
        }