Handle CTCP in notices, too.
[xudocci.git] / src / main / java / net / pterodactylus / irc / event / PrivateNoticeReceived.java
diff --git a/src/main/java/net/pterodactylus/irc/event/PrivateNoticeReceived.java b/src/main/java/net/pterodactylus/irc/event/PrivateNoticeReceived.java
new file mode 100644 (file)
index 0000000..afb6acc
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * XdccDownloader - PrivateNoticeReceived.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.Reply;
+
+/**
+ * Notifies a listener that a notice was received.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class PrivateNoticeReceived extends AbstractReplyEvent {
+
+       /** The target of the notice. */
+       private final String target;
+
+       /** The text of the notice. */
+       private final String text;
+
+       /**
+        * Creates a new notice received event.
+        *
+        * @param connection
+        *              The connection the event occured on
+        * @param reply
+        *              The reply that caused the event
+        */
+       public PrivateNoticeReceived(Connection connection, Reply reply) {
+               super(connection, reply);
+               this.target = reply.parameters().get(0);
+               this.text = reply.parameters().get(1);
+       }
+
+       //
+       // ACCESSORS
+       //
+
+       /**
+        * Returns the target of the notice.
+        *
+        * @return The target of the notice
+        */
+       public String target() {
+               return target;
+       }
+
+       /**
+        * Returns the text of the notice.
+        *
+        * @return The text of the notice
+        */
+       public String text() {
+               return text;
+       }
+
+}