import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
+import net.pterodactylus.sone.core.event.SoneRemovedEvent;
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Client;
import net.pterodactylus.sone.data.Image;
synchronized (sones) {
sones.remove(identity.getId());
}
- coreListenerManager.fireSoneRemoved(sone);
+ eventBus.post(new SoneRemovedEvent(sone));
}
//
public interface CoreListener extends EventListener {
/**
- * 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
//
/**
- * 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)
--- /dev/null
+/*
+ * Sone - SoneRemovedEvent.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.sone.core.event;
+
+import net.pterodactylus.sone.data.Sone;
+
+/**
+ * Event that signals that a {@link Sone} was removed.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class SoneRemovedEvent extends SoneEvent {
+
+ /**
+ * Creates a new “Sone removed” event.
+ *
+ * @param sone
+ * The Sone that was removed
+ */
+ public SoneRemovedEvent(Sone sone) {
+ super(sone);
+ }
+
+}
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
+import net.pterodactylus.sone.core.event.SoneRemovedEvent;
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
mentionNotification.remove(markPostReplyKnownEvent.postReply().getPost());
}
- //
- // CORELISTENER METHODS
- //
-
/**
- * {@inheritDoc}
+ * Notifies the web interface that a {@link Sone} was removed.
+ *
+ * @param soneRemovedEvent
+ * The event
*/
- @Override
- public void soneRemoved(Sone sone) {
- newSoneNotification.remove(sone);
+ @Subscribe
+ public void soneRemoved(SoneRemovedEvent soneRemovedEvent) {
+ newSoneNotification.remove(soneRemovedEvent.sone());
}
+ //
+ // CORELISTENER METHODS
+ //
+
/**
* {@inheritDoc}
*/