🔥 Remove debug messages
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / core / Core.java
index 01460c4..ff7a4e1 100644 (file)
@@ -23,7 +23,6 @@ import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.banned;
 import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.inviteOnly;
 import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.registeredNicknamesOnly;
 import static net.pterodactylus.irc.util.MessageCleaner.getDefaultInstance;
-import static net.pterodactylus.xdcc.data.Channel.TO_NETWORK;
 import static net.pterodactylus.xdcc.data.Download.FILTER_RUNNING;
 
 import java.io.File;
@@ -40,6 +39,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
@@ -187,7 +187,7 @@ public class Core extends AbstractExecutionThreadService {
         * @return All defined networks
         */
        public Collection<Network> networks() {
-               return FluentIterable.from(channels).transform(TO_NETWORK).toSet();
+               return FluentIterable.from(channels).transform(Channel::network).toSet();
        }
 
        /**
@@ -888,6 +888,7 @@ public class Core extends AbstractExecutionThreadService {
        @Subscribe
        public void dccSendReceived(final DccSendReceived dccSendReceived) {
                final Optional<Network> network = getNetwork(dccSendReceived.connection());
+               eventBus.post(new GenericMessage(format("Got DCC Send from %s for %s.", dccSendReceived.source(), dccSendReceived.filename())));
                if (!network.isPresent()) {
                        return;
                }
@@ -904,16 +905,16 @@ public class Core extends AbstractExecutionThreadService {
                }
 
                /* check if it’s already downloading. */
-               if (downloads.values().stream().anyMatch(download -> download.filename().equals(dccSendReceived.filename()) && download.dccReceiver() != null)) {
+               if (downloads.values().stream().anyMatch(download -> Objects.equals(download.filename(), dccSendReceived.filename()) && download.dccReceiver() != null)) {
                        eventBus.post(new GenericMessage(format("Ignoring offer for %s, it’s already being downloaded.", dccSendReceived.filename())));
                        return;
                }
 
                Download download = openDownloads.stream()
-                               .filter(it -> it.filename().equals(dccSendReceived.filename()))
+                               .filter(it -> Objects.equals(it.filename(), dccSendReceived.filename()))
                                .findFirst()
                                .orElse(openDownloads.iterator().next());
-               eventBus.post(new GenericMessage(format("Found no offer for %s, using other download from %s, %s.", dccSendReceived.filename(), dccSendReceived.source(), download.filename())));
+               eventBus.post(new GenericMessage(format("Downloading %s from %s as %s.", dccSendReceived.filename(), dccSendReceived.source(), download.pack().name())));
 
                /* check if the file already exists. */
                File outputFile = new File(temporaryDirectory, dccSendReceived.filename());