X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=12e700ef33df48551e68f8ddb76f8c0b38c26ffa;hp=ef05eba48658eed0b2b3fc1e5a88a88649b1b6f4;hb=fdbdc26c744865a7200017cb117943d48df498ad;hpb=210684b4bc499e298a0d0abeddd4008cdeb406bc diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index ef05eba..12e700e 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.primitives.Longs.tryParse; import static java.lang.String.format; import static java.util.logging.Level.WARNING; -import static net.pterodactylus.sone.data.Sone.toAllAlbums; import java.util.Collection; import java.util.HashMap; @@ -47,7 +46,6 @@ import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidPostReplyFound import net.pterodactylus.sone.core.Options.DefaultOption; import net.pterodactylus.sone.core.SoneChangeDetector.PostProcessor; import net.pterodactylus.sone.core.SoneChangeDetector.PostReplyProcessor; -import net.pterodactylus.sone.core.SoneInserter.SetInsertionDelay; import net.pterodactylus.sone.core.event.ImageInsertFinishedEvent; import net.pterodactylus.sone.core.event.MarkPostKnownEvent; import net.pterodactylus.sone.core.event.MarkPostReplyKnownEvent; @@ -71,7 +69,6 @@ import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.Sone.ShowCustomAvatars; import net.pterodactylus.sone.data.Sone.SoneStatus; -import net.pterodactylus.sone.data.SoneImpl; import net.pterodactylus.sone.data.TemporaryImage; import net.pterodactylus.sone.database.AlbumBuilder; import net.pterodactylus.sone.database.Database; @@ -131,7 +128,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, private final Options options = new Options(); /** The preferences. */ - private final Preferences preferences = new Preferences(options); + private final Preferences preferences; /** The event bus. */ private final EventBus eventBus; @@ -231,6 +228,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, this.webOfTrustUpdater = webOfTrustUpdater; this.eventBus = eventBus; this.database = database; + preferences = new Preferences(this.eventBus, options); } @VisibleForTesting @@ -245,6 +243,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, this.webOfTrustUpdater = webOfTrustUpdater; this.eventBus = eventBus; this.database = database; + preferences = new Preferences(this.eventBus, options); } // @@ -688,6 +687,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, sone.setKnown(true); /* TODO - load posts ’n stuff */ SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId()); + eventBus.register(soneInserter); synchronized (soneInserters) { soneInserters.put(sone, soneInserter); } @@ -736,7 +736,6 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } boolean newSone = !existingSone.isPresent(); Sone sone = !newSone ? existingSone.get() : database.newSoneBuilder().from(identity).build(); - sone.setRequestUri(SoneUri.create(identity.getRequestUri())); sone.setLatestEdition(latestEdition); if (newSone) { synchronized (knownSones) { @@ -1721,7 +1720,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, */ private void loadConfiguration() { /* create options. */ - options.addIntegerOption("InsertionDelay", new DefaultOption(60, new IntegerRangePredicate(0, Integer.MAX_VALUE), new SetInsertionDelay())); + options.addIntegerOption("InsertionDelay", new DefaultOption(60, new IntegerRangePredicate(0, Integer.MAX_VALUE))); options.addIntegerOption("PostsPerPage", new DefaultOption(10, new IntegerRangePredicate(1, Integer.MAX_VALUE))); options.addIntegerOption("ImagesPerPage", new DefaultOption(9, new IntegerRangePredicate(1, Integer.MAX_VALUE))); options.addIntegerOption("CharactersPerPost", new DefaultOption(400, Predicates. or(new IntegerRangePredicate(50, Integer.MAX_VALUE), Predicates.equalTo(-1)))); @@ -1730,8 +1729,8 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, options.addIntegerOption("PositiveTrust", new DefaultOption(75, new IntegerRangePredicate(0, 100))); options.addIntegerOption("NegativeTrust", new DefaultOption(-25, new IntegerRangePredicate(-100, 100))); options.addStringOption("TrustComment", new DefaultOption("Set from Sone Web Interface")); - options.addBooleanOption("ActivateFcpInterface", new DefaultOption(false, fcpInterface.new SetActive())); - options.addIntegerOption("FcpFullAccessRequired", new DefaultOption(2, fcpInterface.new SetFullAccessRequired())); + options.addBooleanOption("ActivateFcpInterface", new DefaultOption(false)); + options.addIntegerOption("FcpFullAccessRequired", new DefaultOption(2)); loadConfigurationValue("InsertionDelay"); loadConfigurationValue("PostsPerPage");