import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.freenet.wot.WebOfTrustException;
import net.pterodactylus.sone.main.SonePlugin;
+import net.pterodactylus.util.collection.Pair;
import net.pterodactylus.util.config.Configuration;
import net.pterodactylus.util.config.ConfigurationException;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.validation.IntegerRangeValidator;
import net.pterodactylus.util.validation.Validation;
import net.pterodactylus.util.version.Version;
+import freenet.client.FetchResult;
import freenet.keys.FreenetURI;
/**
coreListenerManager.fireRescuingSone(sone);
lockSone(sone);
long edition = sone.getLatestEdition();
+ /* find the latest edition the node knows about. */
+ Pair<FreenetURI, FetchResult> currentUri = freenetInterface.fetchUri(sone.getRequestUri());
+ if (currentUri != null) {
+ long currentEdition = currentUri.getLeft().getEdition();
+ if (currentEdition > edition) {
+ edition = currentEdition;
+ }
+ }
while (!stopped && (edition >= 0) && preferences.isSoneRescueMode()) {
logger.log(Level.FINE, "Downloading edition " + edition + "…");
soneDownloader.fetchSone(sone, sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + edition));
for (Sone localSone : getLocalSones()) {
if (localSone.getOptions().getBooleanOption("AutoFollow").get()) {
localSone.addFriend(sone.getId());
+ saveSone(localSone);
}
}
}
for (SoneInserter soneInserter : soneInserters.values()) {
soneInserter.stop();
}
+ for (Sone localSone : localSones.values()) {
+ saveSone(localSone);
+ }
}
updateChecker.stop();
updateChecker.removeUpdateListener(this);
}
synchronized (newSones) {
newSones.remove(identity.getId());
+ coreListenerManager.fireSoneRemoved(sone);
}
}