From: David ‘Bombe’ Roden Date: Sat, 16 Oct 2010 16:01:57 +0000 (+0200) Subject: Add method to reload a known Sone. X-Git-Tag: 0.1-RC1~266 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=1f44c357b7498dc284829defc0309f308e5a9b6d Add method to reload a known Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index b0dadbe..d098456 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -350,6 +350,28 @@ public class Core extends AbstractService { } /** + * Loads and updates the given Sone. + * + * @param sone + * The Sone to load + */ + public void loadSone(final Sone sone) { + new Thread(new Runnable() { + + @Override + @SuppressWarnings("synthetic-access") + public void run() { + FreenetURI realRequestUri = sone.getRequestUri().setMetaString(new String[] { "sone.xml" }); + FetchResult fetchResult = freenetInterface.fetchUri(realRequestUri); + Sone parsedSone = soneDownloader.parseSone(sone, fetchResult, realRequestUri); + if (parsedSone != null) { + addSone(parsedSone); + } + } + }, "Sone Downloader").start(); + } + + /** * Deletes the given Sone from this plugin instance. * * @param sone