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;
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;
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;
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;
this.webOfTrustUpdater = webOfTrustUpdater;
this.eventBus = eventBus;
this.database = database;
+ preferences = new Preferences(this.eventBus, options);
}
@VisibleForTesting
this.webOfTrustUpdater = webOfTrustUpdater;
this.eventBus = eventBus;
this.database = database;
+ preferences = new Preferences(this.eventBus, options);
}
//
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);
}
}
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) {
*/
private void loadConfiguration() {
/* create options. */
- options.addIntegerOption("InsertionDelay", new DefaultOption<Integer>(60, new IntegerRangePredicate(0, Integer.MAX_VALUE), new SetInsertionDelay()));
+ options.addIntegerOption("InsertionDelay", new DefaultOption<Integer>(60, new IntegerRangePredicate(0, Integer.MAX_VALUE)));
options.addIntegerOption("PostsPerPage", new DefaultOption<Integer>(10, new IntegerRangePredicate(1, Integer.MAX_VALUE)));
options.addIntegerOption("ImagesPerPage", new DefaultOption<Integer>(9, new IntegerRangePredicate(1, Integer.MAX_VALUE)));
options.addIntegerOption("CharactersPerPost", new DefaultOption<Integer>(400, Predicates.<Integer> or(new IntegerRangePredicate(50, Integer.MAX_VALUE), Predicates.equalTo(-1))));
options.addIntegerOption("PositiveTrust", new DefaultOption<Integer>(75, new IntegerRangePredicate(0, 100)));
options.addIntegerOption("NegativeTrust", new DefaultOption<Integer>(-25, new IntegerRangePredicate(-100, 100)));
options.addStringOption("TrustComment", new DefaultOption<String>("Set from Sone Web Interface"));
- options.addBooleanOption("ActivateFcpInterface", new DefaultOption<Boolean>(false, fcpInterface.new SetActive()));
- options.addIntegerOption("FcpFullAccessRequired", new DefaultOption<Integer>(2, fcpInterface.new SetFullAccessRequired()));
+ options.addBooleanOption("ActivateFcpInterface", new DefaultOption<Boolean>(false));
+ options.addIntegerOption("FcpFullAccessRequired", new DefaultOption<Integer>(2));
loadConfigurationValue("InsertionDelay");
loadConfigurationValue("PostsPerPage");