import net.pterodactylus.util.config.Configuration;
import net.pterodactylus.util.config.ConfigurationException;
import net.pterodactylus.util.logging.Logging;
-import net.pterodactylus.util.notify.NotificationManager;
import net.pterodactylus.util.number.Numbers;
import freenet.keys.FreenetURI;
/** The options. */
private final Options options = new Options();
+ /** The core listener manager. */
+ private final CoreListenerManager coreListenerManager = new CoreListenerManager(this);
+
/** The configuration. */
private final Configuration configuration;
/** Interface to freenet. */
private final FreenetInterface freenetInterface;
- /** The notification manager. */
- private final NotificationManager notificationManager = new NotificationManager();
-
/** The Sone downloader. */
private final SoneDownloader soneDownloader;
}
//
+ // LISTENER MANAGEMENT
+ //
+
+ /**
+ * Adds a new core listener.
+ *
+ * @param coreListener
+ * The listener to add
+ */
+ public void addCoreListener(CoreListener coreListener) {
+ coreListenerManager.addListener(coreListener);
+ }
+
+ /**
+ * Removes a core listener.
+ *
+ * @param coreListener
+ * The listener to remove
+ */
+ public void removeCoreListener(CoreListener coreListener) {
+ coreListenerManager.removeListener(coreListener);
+ }
+
+ //
// ACCESSORS
//
}
/**
- * Returns the notification manager.
- *
- * @return The notification manager
- */
- public NotificationManager getNotifications() {
- return notificationManager;
- }
-
- /**
* Returns the status of the given Sone.
*
* @param sone
sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), (long) 0));
if (newSone) {
synchronized (newSones) {
- newSones.add(sone.getId());
+ newSone = !knownSones.contains(sone.getId());
+ if (newSone) {
+ newSones.add(sone.getId());
+ }
+ }
+ if (newSone) {
+ coreListenerManager.fireNewSoneFound(sone);
}
}
remoteSones.put(identity.getId(), sone);