X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fcore%2FCore.java;h=db64416d10fbb57902b8f98b4ed0ada797b5a404;hb=845acd1b9805e5cb84ba03f6a493014a38b9e798;hp=ea0428678eac29f15158409d75f02dbd6ff66103;hpb=d0e924c1f40b388082313173ea5f653a0dc66e2e;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index ea04286..db64416 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -892,28 +892,33 @@ public class Core extends AbstractExecutionThreadService { if (!network.isPresent()) { return; } + eventBus.post(new GenericMessage("a")); Set openDownloads = downloads.values().stream() .filter(download -> download.bot().name().equalsIgnoreCase(dccSendReceived.source().nick().orNull())) .filter(download -> download.dccReceiver() == null) .collect(toSet()); + eventBus.post(new GenericMessage("b")); if (openDownloads.isEmpty()) { /* I don't think we requested this. */ eventBus.post(new GenericMessage(format("Ignoring offer for %s, no open download from %s.", dccSendReceived.filename(), dccSendReceived.source()))); return; } + eventBus.post(new GenericMessage("c")); /* check if it’s already downloading. */ if (downloads.values().stream().anyMatch(download -> download.filename().equals(dccSendReceived.filename()) && download.dccReceiver() != null)) { eventBus.post(new GenericMessage(format("Ignoring offer for %s, it’s already being downloaded.", dccSendReceived.filename()))); return; } + eventBus.post(new GenericMessage("d")); Download download = openDownloads.stream() .filter(it -> it.filename().equals(dccSendReceived.filename())) .findFirst() .orElse(openDownloads.iterator().next()); + eventBus.post(new GenericMessage("e")); eventBus.post(new GenericMessage(format("Downloading %s from %s as %s.", dccSendReceived.filename(), dccSendReceived.source(), download.filename()))); /* check if the file already exists. */