From: David ‘Bombe’ Roden Date: Sun, 2 Jan 2011 17:56:00 +0000 (+0100) Subject: Add options for positive and negative trust values. X-Git-Tag: 0.4^2~8^2~32 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=921c8049c4bbfcc59c7bab75d925e18b2311ebdc;p=Sone.git Add options for positive and negative trust values. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index f7b56a1..fc3d99c 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1483,6 +1483,8 @@ public class Core implements IdentityListener { /* store the options first. */ try { 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.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()); @@ -1544,6 +1546,8 @@ public class Core implements IdentityListener { } })); + options.addIntegerOption("PositiveTrust", new DefaultOption(75)); + options.addIntegerOption("NegativeTrust", new DefaultOption(-100)); options.addBooleanOption("SoneRescueMode", new DefaultOption(false)); options.addBooleanOption("ClearOnNextRestart", new DefaultOption(false)); options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption(false)); @@ -1560,6 +1564,8 @@ 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.getBooleanOption("SoneRescueMode").set(configuration.getBooleanValue("Option/SoneRescueMode").getValue(null)); /* load known Sones. */ diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 77f1a07..0c2dbcf 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -55,6 +55,10 @@ public class OptionsPage extends SoneTemplatePage { if (request.getMethod() == Method.POST) { Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16)); options.getIntegerOption("InsertionDelay").set(insertionDelay); + Integer positiveTrust = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("positive-trust", 3), options.getIntegerOption("PositiveTrust").getReal()); + options.getIntegerOption("PositiveTrust").set(positiveTrust); + Integer negativeTrust = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("negative-trust", 3), options.getIntegerOption("NegativeTrust").getReal()); + options.getIntegerOption("NegativeTrust").set(negativeTrust); boolean soneRescueMode = Boolean.parseBoolean(request.getHttpRequest().getPartAsStringFailsafe("sone-rescue-mode", 5)); options.getBooleanOption("SoneRescueMode").set(soneRescueMode); boolean clearOnNextRestart = Boolean.parseBoolean(request.getHttpRequest().getPartAsStringFailsafe("clear-on-next-restart", 5)); @@ -65,6 +69,8 @@ public class OptionsPage extends SoneTemplatePage { throw new RedirectException(getPath()); } template.set("insertion-delay", options.getIntegerOption("InsertionDelay").get()); + template.set("positive-trust", options.getIntegerOption("PositiveTrust").get()); + template.set("negative-trust", options.getIntegerOption("NegativeTrust").get()); template.set("sone-rescue-mode", options.getBooleanOption("SoneRescueMode").get()); template.set("clear-on-next-restart", options.getBooleanOption("ClearOnNextRestart").get()); template.set("really-clear-on-next-restart", options.getBooleanOption("ReallyClearOnNextRestart").get()); diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index 4353ac2..3c20906 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -27,6 +27,9 @@ Page.Options.Page.Title=Options Page.Options.Page.Description=These options influence the runtime behaviour of the Sone plugin. Page.Options.Section.RuntimeOptions.Title=Runtime Behaviour Page.Options.Option.InsertionDelay.Description=The number of seconds the Sone inserter waits after a modification of a Sone before it is being inserted. +Page.Options.Section.TrustOptions.Title=Trust Settings +Page.Options.Option.PositiveTrust.Description=The amount of positive trust you want to assign to other Sones by clicking the checkmark below a post or reply. +Page.Options.Option.NegativeTrust.Description=The amount of trust you want to assign to other Sones by clicking the red X below a post or reply. This value should be negative. Page.Options.Section.RescueOptions.Title=Rescue Settings Page.Options.Option.SoneRescueMode.Description=Try to rescue your Sones at the next start of the Sone plugin. This will read your all your old Sones from Freenet and ignore any disappearing postings and replies. You have to unlock your local Sones after they have been restored and you have to manually disable the rescue mode once you are satisfied with what has been restored! Page.Options.Section.Cleaning.Title=Clean Up diff --git a/src/main/resources/templates/options.html b/src/main/resources/templates/options.html index f0baa50..029837b 100644 --- a/src/main/resources/templates/options.html +++ b/src/main/resources/templates/options.html @@ -20,6 +20,14 @@

<%= Page.Options.Option.InsertionDelay.Description|l10n|html>

+

<%= Page.Options.Section.TrustOptions.Title|l10n|html>

+ +

<%= Page.Options.Option.PositiveTrust.Description|l10n|html>

+

+ +

<%= Page.Options.Option.NegativeTrust.Description|l10n|html>

+

+

<%= Page.Options.Section.RescueOptions.Title|l10n|html>

<%= Page.Options.Option.SoneRescueMode.Description|l10n|html>