X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=053e04280b21a4a63039203a519a3b1a743a0603;hb=1f70b96444f309fbbf338d474af395ff615d244b;hp=234948131965ec3ada7f5e65ea8217fce3cbe3e8;hpb=eae32376d5a6a4a96c8e00fbb0f86f2b8fb3d831;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 2349481..053e042 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -899,8 +899,10 @@ public class Core implements IdentityListener { } /** - * Retrieves the trust relationship from the origin to the target. + * Retrieves the trust relationship from the origin to the target. If the + * trust relationship can not be retrieved, {@code null} is returned. * + * @see Identity#getTrust(OwnIdentity) * @param origin * The origin of the trust tree * @param target @@ -912,12 +914,7 @@ public class Core implements IdentityListener { logger.log(Level.WARNING, "Tried to get trust from remote Sone: %s", origin); return null; } - try { - return target.getIdentity().getTrust((OwnIdentity) origin.getIdentity()); - } catch (WebOfTrustException wote1) { - logger.log(Level.WARNING, "Could not get trust for Sone: " + target, wote1); - return null; - } + return target.getIdentity().getTrust((OwnIdentity) origin.getIdentity()); } /** @@ -957,6 +954,42 @@ public class Core implements IdentityListener { } /** + * Assigns the configured positive trust value for the given target. + * + * @param origin + * The trust origin + * @param target + * The trust target + */ + public void trustSone(Sone origin, Sone target) { + setTrust(origin, target, options.getIntegerOption("PositiveTrust").get()); + } + + /** + * Assigns the configured negative trust value for the given target. + * + * @param origin + * The trust origin + * @param target + * The trust target + */ + public void distrustSone(Sone origin, Sone target) { + setTrust(origin, target, options.getIntegerOption("NegativeTrust").get()); + } + + /** + * Removes the trust assignment for the given target. + * + * @param origin + * The trust origin + * @param target + * The trust target + */ + public void untrustSone(Sone origin, Sone target) { + removeTrust(origin, target); + } + + /** * Updates the stores Sone with the given Sone. * * @param sone @@ -1706,6 +1739,7 @@ public class Core implements IdentityListener { @SuppressWarnings("synthetic-access") public void run() { Sone sone = getRemoteSone(identity.getId()); + sone.setIdentity(identity); soneDownloader.fetchSone(sone); } }).start();