Repost notices to the console.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 16 Apr 2013 18:02:44 +0000 (20:02 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 16 Apr 2013 18:02:44 +0000 (20:02 +0200)
src/main/java/net/pterodactylus/xdcc/core/Core.java

index 7013883..3c3e457 100644 (file)
@@ -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> 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