X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneInserter.java;h=5ae2f7385d0152d2e6f4aa79e6dd2fd081536df1;hb=a3d7f81a00cbac295293916bf965829939b695d9;hp=c38e495b32f5d267f98de0feacae395e0df58c4a;hpb=43740d6a1dfc686ab54d0aebd4a5b1bce75b9ed6;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index c38e495..5ae2f73 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -39,6 +39,7 @@ import net.pterodactylus.sone.core.event.SoneInsertAbortedEvent; import net.pterodactylus.sone.core.event.SoneInsertedEvent; import net.pterodactylus.sone.core.event.SoneInsertingEvent; import net.pterodactylus.sone.data.Album; +import net.pterodactylus.sone.data.LocalSone; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; @@ -120,7 +121,7 @@ public class SoneInserter extends AbstractService { this(core, eventBus, freenetInterface, soneId, new SoneModificationDetector(new LockableFingerprintProvider() { @Override public boolean isLocked() { - final Optional sone = core.getSone(soneId); + final Optional sone = core.getLocalSone(soneId); if (!sone.isPresent()) { return false; } @@ -214,12 +215,12 @@ public class SoneInserter extends AbstractService { sleep(delay); if (soneModificationDetector.isEligibleForInsert()) { - Optional soneOptional = core.getSone(soneId); + Optional soneOptional = core.getLocalSone(soneId); if (!soneOptional.isPresent()) { logger.log(Level.WARNING, format("Sone %s has disappeared, exiting inserter.", soneId)); return; } - Sone sone = soneOptional.get(); + LocalSone sone = soneOptional.get(); InsertInformation insertInformation = new InsertInformation(sone); logger.log(Level.INFO, String.format("Inserting Sone “%s”…", sone.getName())); @@ -229,7 +230,7 @@ public class SoneInserter extends AbstractService { long insertTime = currentTimeMillis(); eventBus.post(new SoneInsertingEvent(sone)); FreenetURI finalUri = freenetInterface.insertDirectory(sone.getInsertUri(), insertInformation.generateManifestEntries(), "index.html"); - eventBus.post(new SoneInsertedEvent(sone, currentTimeMillis() - insertTime)); + eventBus.post(new SoneInsertedEvent(sone, currentTimeMillis() - insertTime, insertInformation.getFingerprint())); /* at this point we might already be stopped. */ if (shouldStop()) { /* if so, bail out, don’t change anything. */