import net.pterodactylus.irc.DccReceiver;
import net.pterodactylus.xdcc.core.Core;
+import net.pterodactylus.xdcc.core.event.DownloadFailed;
import net.pterodactylus.xdcc.core.event.DownloadFinished;
import net.pterodactylus.xdcc.core.event.DownloadStarted;
import net.pterodactylus.xdcc.data.Bot;
}
}
+ /**
+ * Called when a download fails.
+ *
+ * @param downloadFailed
+ * The download failed event
+ */
+ @Subscribe
+ public void downloadFailed(DownloadFailed downloadFailed) {
+ Download download = downloadFailed.download();
+ try {
+ writer.write(String.format("Download of %s (from %s, %s) has failed at %.1f%% and %s/s.\n", download.filename(), download.bot().name(), download.bot().network().name(), download.dccReceiver().progress() * 100.0 / download.dccReceiver().size(), f(download.dccReceiver().overallRate())));
+ writer.flush();
+ } catch (IOException ioe1) {
+ /* ignore. */
+ }
+ }
+
//
// PRIVATE METHODS
//