Update year in copyright lines
[WoTNS.git] / src / main / java / net / pterodactylus / wotns / freenet / wot / IdentityManager.java
index ea90dac..1961cac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - IdentityManager.java - Copyright © 2010 David Roden
+ * WoTNS - IdentityManager.java - Copyright © 2010–2017 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@ public class IdentityManager extends AbstractService {
         *            The Web of Trust connector
         */
        public IdentityManager(WebOfTrustConnector webOfTrustConnector) {
-               super("Sone Identity Manager", false);
+               super("WoTNS Identity Manager", false);
                this.webOfTrustConnector = webOfTrustConnector;
        }
 
@@ -182,8 +182,10 @@ public class IdentityManager extends AbstractService {
         */
        public Set<Identity> getTrustedIdentities(OwnIdentity ownIdentity) {
                Set<Identity> identities = new HashSet<Identity>();
-               if ((context == null) || ownIdentity.getContexts().contains(context)) {
-                       identities.add(ownIdentity);
+               for (OwnIdentity additionalOwnIdentity : getAllOwnIdentities()) {
+                       if ((context == null) || additionalOwnIdentity.getContexts().contains(context)) {
+                               identities.add(additionalOwnIdentity);
+                       }
                }
                try {
                        Set<Identity> trustedIdentities = webOfTrustConnector.loadTrustedIdentities(ownIdentity, context);
@@ -192,6 +194,7 @@ public class IdentityManager extends AbstractService {
                                newTrustedIdentities.put(trustedIdentity.getId(), trustedIdentity);
                        }
                        checkTrustedIdentities(ownIdentity, newTrustedIdentities);
+                       identities.addAll(trustedIdentities);
                } catch (WebOfTrustException wote1) {
                        logger.log(Level.WARNING, String.format("Could not load all trusted identities for %s.", ownIdentity), wote1);
                }
@@ -209,7 +212,6 @@ public class IdentityManager extends AbstractService {
        protected void serviceRun() {
                while (!shouldStop()) {
                        Map<OwnIdentity, Map<String, Identity>> currentIdentities = new HashMap<OwnIdentity, Map<String, Identity>>();
-                       @SuppressWarnings("hiding")
                        Map<String, OwnIdentity> currentOwnIdentities = new HashMap<String, OwnIdentity>();
 
                        Set<OwnIdentity> ownIdentities = null;
@@ -311,7 +313,6 @@ public class IdentityManager extends AbstractService {
         */
        private void checkTrustedIdentities(OwnIdentity ownIdentity, Map<String, Identity> trustedIdentities) {
 
-               @SuppressWarnings("hiding")
                Map<String, Identity> currentTrustedIdentities = new HashMap<String, Identity>();
                synchronized (syncObject) {
                        if (this.currentTrustedIdentities.containsKey(ownIdentity)) {