Add events for messages.
[xudocci.git] / src / main / java / net / pterodactylus / irc / event / ChannelMessageReceived.java
diff --git a/src/main/java/net/pterodactylus/irc/event/ChannelMessageReceived.java b/src/main/java/net/pterodactylus/irc/event/ChannelMessageReceived.java
new file mode 100644 (file)
index 0000000..5cb6349
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * XdccDownloader - MessageReceived.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.irc.event;
+
+import net.pterodactylus.irc.Connection;
+import net.pterodactylus.irc.Source;
+
+/**
+ * Notifies a listener that a channel message was received.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class ChannelMessageReceived extends AbstractChannelEvent {
+
+       /** The source of the message. */
+       private final Source source;
+
+       /** The text of the message. */
+       private final String message;
+
+       /**
+        * Creates a new channel message received event.
+        *
+        * @param connection
+        *              The connection the event occured on
+        * @param channel
+        *              The channel of the message
+        * @param source
+        *              The source of the message
+        * @param message
+        *              The text of the message
+        */
+       public ChannelMessageReceived(Connection connection, String channel, Source source, String message) {
+               super(connection, channel);
+               this.source = source;
+               this.message = message;
+       }
+
+       //
+       // ACCESSORS
+       //
+
+       /**
+        * Returns the source of the message.
+        *
+        * @return The source of the message
+        */
+       public Source source() {
+               return source;
+       }
+
+       /**
+        * Returns the text of the message.
+        *
+        * @return The text of the message
+        */
+       public String message() {
+               return message;
+       }
+
+}