Fire a “new Sone found” event when a new Sone is found.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 14 Nov 2010 16:10:36 +0000 (17:10 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 14 Nov 2010 16:10:36 +0000 (17:10 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 2f69bee..2894945 100644 (file)
@@ -679,7 +679,13 @@ public class Core implements IdentityListener {
                        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);