From: David ‘Bombe’ Roden Date: Thu, 11 Apr 2013 05:33:04 +0000 (+0200) Subject: Ignore unrequested downloads. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=dca760d9a6b05c401fdb67729cdd43281bb5daf6;p=xudocci.git Ignore unrequested downloads. --- diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 8aa31e2..0c66644 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -344,6 +344,17 @@ public class Core extends AbstractIdleService { */ @Subscribe public void dccSendReceived(DccSendReceived dccSendReceived) { + Optional network = getNetwork(dccSendReceived.connection()); + if (!network.isPresent()) { + return; + } + + Download download = downloads.get(dccSendReceived.filename()); + if (download == null) { + /* unknown download, ignore. */ + return; + } + logger.info(String.format("Starting download of %s.", dccSendReceived.filename())); try { File outputFile = new File(temporaryDirectory, dccSendReceived.filename());