From 6fa3e26eb2deda14bd56dd343011b5735d449104 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 8 Nov 2010 20:42:20 +0100 Subject: [PATCH] Add Sones as new when they are first added. --- src/main/java/net/pterodactylus/sone/core/Core.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index af1523a..132e4a6 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -106,6 +106,9 @@ public class Core implements IdentityListener { /* synchronize access on this on itself. */ private Map remoteSones = new HashMap(); + /** All new Sones. */ + private Set newSones = new HashSet(); + /** All posts. */ private Map posts = new HashMap(); @@ -508,9 +511,15 @@ public class Core implements IdentityListener { return null; } synchronized (remoteSones) { + boolean newSone = !isRemoteSone(identity.getId()); final Sone sone = getRemoteSone(identity.getId()).setIdentity(identity); sone.setRequestUri(getSoneUri(identity.getRequestUri())); sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), (long) 0)); + if (newSone) { + synchronized (newSones) { + newSones.add(sone); + } + } remoteSones.put(identity.getId(), sone); soneDownloader.addSone(sone); setSoneStatus(sone, SoneStatus.unknown); -- 2.7.4