Ignore case of channel names when locating the channel.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / core / Core.java
index e3b981b..248f765 100644 (file)
@@ -408,6 +408,7 @@ public class Core extends AbstractIdleService {
                        File file = new File(download.filename());
                        file.renameTo(new File(finalDirectory, download.pack().name()));
                        eventBus.post(new DownloadFinished(download));
+                       dccReceivers.remove(dccDownloadFinished.dccReceiver());
                } catch (IOException ioe1) {
                        /* TODO - handle all the errors. */
                        logger.log(Level.WARNING, String.format("Could not move file %s to directory %s.", download.filename(), finalDirectory), ioe1);
@@ -431,6 +432,7 @@ public class Core extends AbstractIdleService {
                try {
                        Closeables.close(download.outputStream(), true);
                        eventBus.post(new DownloadFailed(download));
+                       dccReceivers.remove(dccDownloadFailed.dccReceiver());
                } catch (IOException ioe1) {
                        /* swallow silently. */
                }
@@ -470,7 +472,7 @@ public class Core extends AbstractIdleService {
         */
        public Optional<Channel> getChannel(Network network, String channelName) {
                for (Channel channel : channels) {
-                       if (channel.network().equals(network) && (channel.name().equals(channelName))) {
+                       if (channel.network().equals(network) && (channel.name().equalsIgnoreCase(channelName))) {
                                return Optional.of(channel);
                        }
                }