From c0bc71bd241cb16659b07b1d83204f21af0c7695 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 16 Apr 2013 20:02:44 +0200 Subject: [PATCH] Repost notices to the console. --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 7013883..3c3e457 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -46,6 +46,7 @@ import net.pterodactylus.irc.event.DccDownloadFailed; import net.pterodactylus.irc.event.DccDownloadFinished; import net.pterodactylus.irc.event.DccSendReceived; import net.pterodactylus.irc.event.NicknameChanged; +import net.pterodactylus.irc.event.PrivateNoticeReceived; import net.pterodactylus.irc.event.PrivateMessageReceived; import net.pterodactylus.irc.util.MessageCleaner; import net.pterodactylus.irc.util.RandomNickname; @@ -533,6 +534,22 @@ public class Core extends AbstractExecutionThreadService { } /** + * Sends a message to all console when a notice was received. + * + * @param privateNoticeReceived + * The notice received event + */ + @Subscribe + public void privateNoticeReceived(PrivateNoticeReceived privateNoticeReceived) { + Optional network = getNetwork(privateNoticeReceived.connection()); + if (!network.isPresent()) { + return; + } + + eventBus.post(new GenericMessage(String.format("Notice from %s (%s): %s", privateNoticeReceived.reply().source(), network.get(), privateNoticeReceived.text()))); + } + + /** * Starts a DCC download. * * @param dccSendReceived -- 2.7.4