import net.pterodactylus.sone.core.Options.Option;
import net.pterodactylus.sone.core.Options.OptionWatcher;
import net.pterodactylus.sone.core.event.MarkPostKnownEvent;
+import net.pterodactylus.sone.core.event.MarkPostReplyKnownEvent;
import net.pterodactylus.sone.core.event.MarkSoneKnownEvent;
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
public void markReplyKnown(PostReply reply) {
reply.setKnown(true);
synchronized (knownReplies) {
- coreListenerManager.fireMarkReplyKnown(reply);
+ eventBus.post(new MarkPostReplyKnownEvent(reply));
if (knownReplies.add(reply.getId())) {
touchConfiguration();
}
public interface CoreListener extends EventListener {
/**
- * Notifies a listener that the given reply is now marked as known.
- *
- * @param reply
- * The known reply
- */
- public void markReplyKnown(PostReply reply);
-
- /**
* Notifies a listener that the given Sone was removed.
*
* @param sone
//
/**
- * Notifies all listeners that the given reply is now marked as known.
- *
- * @param reply
- * The known reply
- */
- void fireMarkReplyKnown(PostReply reply) {
- for (CoreListener coreListener : getListeners()) {
- coreListener.markReplyKnown(reply);
- }
- }
-
- /**
* Notifies all listener that the given Sone was removed.
*
* @see CoreListener#soneRemoved(Sone)
--- /dev/null
+/*
+ * Sone - MarkPostReplyKnownEvent.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.PostReply;
+
+/**
+ * Event that signals that a {@line PostReply} has been marked as
+ * {@link PostReply#isKnown() known}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class MarkPostReplyKnownEvent extends PostReplyEvent {
+
+ /**
+ * Creates a new “post reply marked known” event.
+ *
+ * @param postReply
+ * The post reply that was marked as known
+ */
+ public MarkPostReplyKnownEvent(PostReply postReply) {
+ super(postReply);
+ }
+
+}
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.core.CoreListener;
import net.pterodactylus.sone.core.event.MarkPostKnownEvent;
+import net.pterodactylus.sone.core.event.MarkPostReplyKnownEvent;
import net.pterodactylus.sone.core.event.MarkSoneKnownEvent;
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
mentionNotification.remove(markPostKnownEvent.post());
}
- //
- // CORELISTENER METHODS
- //
-
/**
* {@inheritDoc}
*/
- @Override
- public void markReplyKnown(PostReply reply) {
- newReplyNotification.remove(reply);
- localReplyNotification.remove(reply);
- mentionNotification.remove(reply.getPost());
+ @Subscribe
+ public void markReplyKnown(MarkPostReplyKnownEvent markPostReplyKnownEvent) {
+ newReplyNotification.remove(markPostReplyKnownEvent.postReply());
+ localReplyNotification.remove(markPostReplyKnownEvent.postReply());
+ mentionNotification.remove(markPostReplyKnownEvent.postReply().getPost());
}
+ //
+ // CORELISTENER METHODS
+ //
+
/**
* {@inheritDoc}
*/