import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Sone.SoneStatus;
+import net.pterodactylus.sone.database.Database;
import net.pterodactylus.sone.freenet.StringBucket;
import net.pterodactylus.sone.main.SonePlugin;
import net.pterodactylus.util.io.Closer;
/** The Freenet interface. */
private final FreenetInterface freenetInterface;
-
+ private final Database database;
private final SoneModificationDetector soneModificationDetector;
private final long delay;
private final String soneId;
* @param soneId
* The ID of the Sone to insert
*/
- public SoneInserter(final Core core, EventBus eventBus, FreenetInterface freenetInterface, final String soneId) {
- this(core, eventBus, freenetInterface, soneId, new SoneModificationDetector(new LockableFingerprintProvider() {
+ public SoneInserter(final Core core, EventBus eventBus, FreenetInterface freenetInterface, Database database, final String soneId) {
+ this(core, eventBus, freenetInterface, database, soneId, new SoneModificationDetector(new LockableFingerprintProvider() {
@Override
public boolean isLocked() {
final Optional<LocalSone> sone = core.getLocalSone(soneId);
}
@VisibleForTesting
- SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, String soneId, SoneModificationDetector soneModificationDetector, long delay) {
+ SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Database database, String soneId, SoneModificationDetector soneModificationDetector, long delay) {
super("Sone Inserter for “" + soneId + "”", false);
this.core = core;
this.eventBus = eventBus;
this.freenetInterface = freenetInterface;
+ this.database = database;
this.soneId = soneId;
this.soneModificationDetector = soneModificationDetector;
this.delay = delay;
/* if so, bail out, don’t change anything. */
break;
}
- sone.setTime(insertTime);
+ database.updateSoneTime(sone, insertTime);
sone.setLatestEdition(finalUri.getEdition());
core.touchConfiguration();
success = true;