From dca760d9a6b05c401fdb67729cdd43281bb5daf6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 11 Apr 2013 07:33:04 +0200 Subject: [PATCH] Ignore unrequested downloads. --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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()); -- 2.7.4