X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneDownloader.java;h=b7871dd012092ac8ba9bbdda407098656cd7d874;hb=b766f47ecf1c68004a5d3b2050f8853e041b157a;hp=193d32841df68782cc654aef51df9aea4383f655;hpb=18f776785f9b87b2ac1f10e6a2ac80b607ef7c9d;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index 193d328..b7871dd 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -89,6 +89,18 @@ public class SoneDownloader extends AbstractService { } /** + * Removes the given Sone from the downloader. + * + * @param sone + * The Sone to stop watching + */ + public void removeSone(Sone sone) { + if (sones.remove(sone)) { + freenetInterface.unregisterUsk(sone); + } + } + + /** * Fetches the updated Sone. This method is a callback method for * {@link FreenetInterface#registerUsk(Sone, SoneDownloader)}. * @@ -102,6 +114,15 @@ public class SoneDownloader extends AbstractService { parseSone(sone, fetchResult); } + /** + * Parses a Sone from a fetch result. + * + * @param sone + * The sone to parse, or {@code null} if the Sone is yet unknown + * @param fetchResult + * The fetch result + * @return The parsed Sone, or {@code null} if the Sone could not be parsed + */ public Sone parseSone(Sone sone, FetchResult fetchResult) { logger.log(Level.FINEST, "Persing FetchResult (%d bytes, %s) for %s…", new Object[] { fetchResult.size(), fetchResult.getMimeType(), sone }); /* TODO - impose a size limit? */