From: David ‘Bombe’ Roden Date: Mon, 8 Nov 2010 19:42:20 +0000 (+0100) Subject: Add Sones as new when they are first added. X-Git-Tag: 0.2.1~23 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6fa3e26eb2deda14bd56dd343011b5735d449104;p=Sone.git Add Sones as new when they are first added. --- 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);