/** 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;
}
//
+ // 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
//
synchronized (newSones) {
boolean isNew = !knownSones.contains(sone.getId()) && newSones.remove(sone.getId());
knownSones.add(sone.getId());
+ if (isNew) {
+ coreListenerManager.fireMarkSoneKnown(sone);
+ }
return isNew;
}
}
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);
}
synchronized (storedSone) {
storedSone.setTime(sone.getTime());
+ storedSone.setClient(sone.getClient());
storedSone.setProfile(sone.getProfile());
storedSone.setPosts(sone.getPosts());
storedSone.setReplies(sone.getReplies());