Send event when the core is started.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 8 Apr 2013 20:15:45 +0000 (22:15 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 8 Apr 2013 20:15:45 +0000 (22:15 +0200)
src/main/java/net/pterodactylus/xdcc/core/Core.java
src/main/java/net/pterodactylus/xdcc/core/event/CoreStarted.java [new file with mode: 0644]

index 00e31c6..58afb8e 100644 (file)
@@ -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 (file)
index 0000000..79431e0
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.xdcc.core.event;
+
+import net.pterodactylus.xdcc.core.Core;
+
+/**
+ * Notifies all listeners that a {@link Core} was started.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+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;
+       }
+
+}