From: David ‘Bombe’ Roden Date: Sat, 6 Nov 2010 11:14:05 +0000 (+0100) Subject: Check for changes in the context list, too. X-Git-Tag: 0.2-RC2~7 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f787966bd8ba2d1a50690339b0e14424d8591f8c;p=Sone.git Check for changes in the context list, too. --- diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java index 16789d1..ef8b3b6 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java @@ -289,6 +289,26 @@ public class IdentityManager extends AbstractService { } } + /* check for changes in the contexts. */ + for (Identity oldIdentity : oldIdentities.values()) { + if (!currentIdentities.containsKey(oldIdentity.getId())) { + continue; + } + Identity newIdentity = currentIdentities.get(oldIdentity.getId()); + Set oldContexts = oldIdentity.getContexts(); + Set newContexts = newIdentity.getContexts(); + if (oldContexts.size() != newContexts.size()) { + identityListenerManager.fireIdentityUpdated(newIdentity); + continue; + } + for (String oldContext : oldContexts) { + if (!newContexts.contains(oldContext)) { + identityListenerManager.fireIdentityUpdated(newIdentity); + break; + } + } + } + /* check for changes in the properties. */ for (Identity oldIdentity : oldIdentities.values()) { if (!currentIdentities.containsKey(oldIdentity.getId())) {