From f787966bd8ba2d1a50690339b0e14424d8591f8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 6 Nov 2010 12:14:05 +0100 Subject: [PATCH] Check for changes in the context list, too. --- .../sone/freenet/wot/IdentityManager.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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())) { -- 2.7.4