X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=7277533a0aeaa3fc4d942565d2d899a0eccd6881;hb=ea4ab9f63c90fef520d9ffded078ade1cd467445;hp=7565ca43142beb4c42e7c6c7fcb7de5acddeff64;hpb=dc00af042b10cb97d7f7e3c286e553f96c44f299;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 7565ca4..7277533 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()); } /** @@ -933,7 +930,7 @@ public class Core implements IdentityListener { public void setTrust(Sone origin, Sone target, int trustValue) { Validation.begin().isNotNull("Trust Origin", origin).check().isInstanceOf("Trust Origin", origin.getIdentity(), OwnIdentity.class).isNotNull("Trust Target", target).isLessOrEqual("Trust Value", trustValue, 100).isGreaterOrEqual("Trust Value", trustValue, -100).check(); try { - ((OwnIdentity) origin.getIdentity()).setTrust(target.getIdentity(), trustValue, "Set from Sone Web Interface"); + ((OwnIdentity) origin.getIdentity()).setTrust(target.getIdentity(), trustValue, options.getStringOption("TrustComment").get()); } catch (WebOfTrustException wote1) { logger.log(Level.WARNING, "Could not set trust for Sone: " + target, wote1); } @@ -1558,6 +1555,7 @@ public class Core implements IdentityListener { configuration.getIntValue("Option/InsertionDelay").setValue(options.getIntegerOption("InsertionDelay").getReal()); configuration.getIntValue("Option/PositiveTrust").setValue(options.getIntegerOption("PositiveTrust").getReal()); configuration.getIntValue("Option/NegativeTrust").setValue(options.getIntegerOption("NegativeTrust").getReal()); + configuration.getStringValue("Option/TrustComment").setValue(options.getStringOption("TrustComment").getReal()); configuration.getBooleanValue("Option/SoneRescueMode").setValue(options.getBooleanOption("SoneRescueMode").getReal()); configuration.getBooleanValue("Option/ClearOnNextRestart").setValue(options.getBooleanOption("ClearOnNextRestart").getReal()); configuration.getBooleanValue("Option/ReallyClearOnNextRestart").setValue(options.getBooleanOption("ReallyClearOnNextRestart").getReal()); @@ -1621,6 +1619,7 @@ public class Core implements IdentityListener { })); options.addIntegerOption("PositiveTrust", new DefaultOption(75)); options.addIntegerOption("NegativeTrust", new DefaultOption(-100)); + options.addStringOption("TrustComment", new DefaultOption("Set from Sone Web Interface")); options.addBooleanOption("SoneRescueMode", new DefaultOption(false)); options.addBooleanOption("ClearOnNextRestart", new DefaultOption(false)); options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption(false)); @@ -1639,6 +1638,7 @@ public class Core implements IdentityListener { options.getIntegerOption("InsertionDelay").set(configuration.getIntValue("Option/InsertionDelay").getValue(null)); options.getIntegerOption("PositiveTrust").set(configuration.getIntValue("Option/PositiveTrust").getValue(null)); options.getIntegerOption("NegativeTrust").set(configuration.getIntValue("Option/NegativeTrust").getValue(null)); + options.getStringOption("TrustComment").set(configuration.getStringValue("Option/TrustComment").getValue(null)); options.getBooleanOption("SoneRescueMode").set(configuration.getBooleanValue("Option/SoneRescueMode").getValue(null)); /* load known Sones. */ @@ -1742,6 +1742,7 @@ public class Core implements IdentityListener { @SuppressWarnings("synthetic-access") public void run() { Sone sone = getRemoteSone(identity.getId()); + sone.setIdentity(identity); soneDownloader.fetchSone(sone); } }).start();