Check for changes in the context list, too.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 6 Nov 2010 11:14:05 +0000 (12:14 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 6 Nov 2010 11:14:05 +0000 (12:14 +0100)
src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java

index 16789d1..ef8b3b6 100644 (file)
@@ -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<String> oldContexts = oldIdentity.getContexts();
+                                       Set<String> 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())) {