import net.pterodactylus.irc.event.DccAcceptReceived;
import net.pterodactylus.irc.event.DccSendReceived;
import net.pterodactylus.irc.event.MotdReceived;
+import net.pterodactylus.irc.event.NicknameChanged;
import net.pterodactylus.irc.event.NicknameInUseReceived;
import net.pterodactylus.irc.event.NoNicknameGivenReceived;
import net.pterodactylus.irc.event.PrivateMessageReceived;
eventBus.post(new NicknameInUseReceived(this, reply));
}
+ /* client stuff. */
+ } else if (command.equalsIgnoreCase("NICK")) {
+ eventBus.post(new NicknameChanged(this, reply.source().get(), parameters.get(0)));
+
/* channel stuff. */
} else if (command.equalsIgnoreCase("JOIN")) {
eventBus.post(new ChannelJoined(this, parameters.get(0), reply.source().get()));
--- /dev/null
+/*
+ * XdccDownloader - NicknameChanged.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 client has changed its nickname.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class NicknameChanged extends AbstractConnectionEvent {
+
+ /** The client that changed its nickname. */
+ private final Source client;
+
+ /** The new nickname of the client. */
+ private final String newNickname;
+
+ /**
+ * Creates a new nickname changed event.
+ *
+ * @param connection
+ * The connection the event occured on
+ * @param client
+ * The client that changed its nickname
+ * @param newNickname
+ * The new nickname of the client
+ */
+ public NicknameChanged(Connection connection, Source client, String newNickname) {
+ super(connection);
+ this.client = client;
+ this.newNickname = newNickname;
+ }
+
+ //
+ // ACCESSORS
+ //
+
+ /**
+ * Returns the client that changed its nickname.
+ *
+ * @return The client that changed its nickname
+ */
+ public Source client() {
+ return client;
+ }
+
+ /**
+ * Returns the new nickname of the client.
+ *
+ * @return The new nickname of the client
+ */
+ public String newNickname() {
+ return newNickname;
+ }
+
+}