import net.pterodactylus.sone.core.Options.DefaultOption;
import net.pterodactylus.sone.core.Options.Option;
import net.pterodactylus.sone.core.Options.OptionWatcher;
+import net.pterodactylus.sone.core.event.MarkSoneKnownEvent;
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
synchronized (knownSones) {
knownSones.add(sone.getId());
}
- coreListenerManager.fireMarkSoneKnown(sone);
+ eventBus.post(new MarkSoneKnownEvent(sone));
touchConfiguration();
}
}
public interface CoreListener extends EventListener {
/**
- * Notifies a listener that the given Sone is now marked as known.
- *
- * @param sone
- * The known Sone
- */
- public void markSoneKnown(Sone sone);
-
- /**
* Notifies a listener that the given post is now marked as known.
*
* @param post
//
/**
- * Notifies all listeners that the given Sone is now marked as known.
- *
- * @see CoreListener#markSoneKnown(Sone)
- * @param sone
- * The known Sone
- */
- void fireMarkSoneKnown(Sone sone) {
- for (CoreListener coreListener : getListeners()) {
- coreListener.markSoneKnown(sone);
- }
- }
-
- /**
* Notifies all listeners that the given post is now marked as known.
*
* @param post
--- /dev/null
+/*
+ * Sone - MarkSoneKnownEvent.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 {@line Sone} has been marked as
+ * {@link Sone#isKnown() known}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class MarkSoneKnownEvent extends SoneEvent {
+
+ /**
+ * Creates a new “Sone marked known” event.
+ *
+ * @param sone
+ * The Sone that was marked as known
+ */
+ public MarkSoneKnownEvent(Sone sone) {
+ super(sone);
+ }
+
+}
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.core.CoreListener;
+import net.pterodactylus.sone.core.event.MarkSoneKnownEvent;
import net.pterodactylus.sone.core.event.NewPostFoundEvent;
import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
}
}
- //
- // CORELISTENER METHODS
- //
-
/**
* {@inheritDoc}
*/
- @Override
- public void markSoneKnown(Sone sone) {
- newSoneNotification.remove(sone);
+ @Subscribe
+ public void markSoneKnown(MarkSoneKnownEvent markSoneKnownEvent) {
+ newSoneNotification.remove(markSoneKnownEvent.sone());
}
+ //
+ // CORELISTENER METHODS
+ //
+
/**
* {@inheritDoc}
*/