X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneRescuer.java;h=adc0925ec9dd2befc8b2fbc53082dbc1452e5b11;hb=5896b708bc8ca0b4e3b8f240875b1fa0930a895e;hp=2ca4b4ac59a106ba1063a1dc9239fb2fa131cbfb;hpb=419098bcd6215125408b29e60bd888e60979d37b;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java index 2ca4b4a..adc0925 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java @@ -1,5 +1,5 @@ /* - * Sone - SoneRescuer.java - Copyright © 2011–2015 David Roden + * Sone - SoneRescuer.java - Copyright © 2011–2019 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,8 +24,6 @@ import freenet.keys.FreenetURI; /** * The Sone rescuer downloads older editions of a Sone and updates the currently * stored Sone with it. - * - * @author David ‘Bombe’ Roden */ public class SoneRescuer extends AbstractService { @@ -110,18 +108,6 @@ public class SoneRescuer extends AbstractService { } /** - * Sets the edition to rescue. - * - * @param edition - * The edition to rescue - * @return This Sone rescuer - */ - public SoneRescuer setEdition(long edition) { - currentEdition = edition; - return this; - } - - /** * Sets whether the last fetch was successful. * * @return {@code true} if the last fetch was successful, {@code false} @@ -137,9 +123,7 @@ public class SoneRescuer extends AbstractService { // /** - * Starts the next fetch. If you want to fetch a different edition than “the - * next older one,” remember to call {@link #setEdition(long)} before - * calling this method. + * Starts the next fetch. */ public void startNextFetch() { fetching = true; @@ -161,13 +145,14 @@ public class SoneRescuer extends AbstractService { } if (fetching) { core.lockSone(sone); - FreenetURI soneUri = sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + currentEdition).setMetaString(new String[] { "sone.xml" }); + FreenetURI soneUri = sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + getNextEdition()).setMetaString(new String[] { "sone.xml" }); System.out.println("URI: " + soneUri); Sone fetchedSone = soneDownloader.fetchSone(sone, soneUri, true); System.out.println("Sone: " + fetchedSone); lastFetchSuccessful = (fetchedSone != null); if (lastFetchSuccessful) { core.updateSone(fetchedSone, true); + currentEdition = getNextEdition(); } fetching = false; }