From: David ‘Bombe’ Roden Date: Tue, 16 Apr 2013 18:02:44 +0000 (+0200) Subject: Repost notices to the console. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c0bc71bd241cb16659b07b1d83204f21af0c7695;p=xudocci.git Repost notices to the console. --- 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