From 217a38af85ffb6cc6ddc5276b8915da12d15631c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 8 Apr 2013 22:15:45 +0200 Subject: [PATCH] Send event when the core is started. --- .../java/net/pterodactylus/xdcc/core/Core.java | 4 ++ .../pterodactylus/xdcc/core/event/CoreStarted.java | 55 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/main/java/net/pterodactylus/xdcc/core/event/CoreStarted.java diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 00e31c6..58afb8e 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -32,6 +32,7 @@ import net.pterodactylus.irc.event.ChannelMessageReceived; import net.pterodactylus.irc.event.ConnectionEstablished; import net.pterodactylus.irc.util.MessageCleaner; import net.pterodactylus.irc.util.RandomNickname; +import net.pterodactylus.xdcc.core.event.CoreStarted; import net.pterodactylus.xdcc.data.Bot; import net.pterodactylus.xdcc.data.Channel; import net.pterodactylus.xdcc.data.Network; @@ -114,6 +115,9 @@ public class Core extends AbstractIdleService { connection.start(); } } + + /* notify listeners. */ + eventBus.post(new CoreStarted(this)); } @Override diff --git a/src/main/java/net/pterodactylus/xdcc/core/event/CoreStarted.java b/src/main/java/net/pterodactylus/xdcc/core/event/CoreStarted.java new file mode 100644 index 0000000..79431e0 --- /dev/null +++ b/src/main/java/net/pterodactylus/xdcc/core/event/CoreStarted.java @@ -0,0 +1,55 @@ +/* + * XdccDownloader - CoreStarted.java - Copyright © 2013 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.xdcc.core.event; + +import net.pterodactylus.xdcc.core.Core; + +/** + * Notifies all listeners that a {@link Core} was started. + * + * @author David ‘Bombe’ Roden + */ +public class CoreStarted { + + /** The core that was started. */ + private final Core core; + + /** + * Creates a new core started event. + * + * @param core + * The core that was started + */ + public CoreStarted(Core core) { + this.core = core; + } + + // + // ACCESSORS + // + + /** + * Returns the core that was started. + * + * @return The core that was started + */ + public Core core() { + return core; + } + +} -- 2.7.4