Show reason if channel can not be joined because the nickname is not registered.
[xudocci.git] / src / main / java / net / pterodactylus / irc / Connection.java
index fb67fe7..2f89414 100644 (file)
@@ -52,6 +52,7 @@ import net.pterodactylus.irc.event.ConnectionEstablished;
 import net.pterodactylus.irc.event.ConnectionFailed;
 import net.pterodactylus.irc.event.DccAcceptReceived;
 import net.pterodactylus.irc.event.DccSendReceived;
+import net.pterodactylus.irc.event.KickedFromChannel;
 import net.pterodactylus.irc.event.MotdReceived;
 import net.pterodactylus.irc.event.NicknameChanged;
 import net.pterodactylus.irc.event.NicknameInUseReceived;
@@ -452,6 +453,8 @@ public class Connection extends AbstractExecutionThreadService implements Servic
                                        eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.inviteOnly));
                                } else if (command.equals("475")) {
                                        eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.badChannelKey));
+                               } else if (command.equals("477")) {
+                                       eventBus.post(new ChannelNotJoined(this, parameters.get(1), Reason.registeredNicknamesOnly));
 
                                /* basic connection housekeeping. */
                                } else if (command.equalsIgnoreCase("PING")) {
@@ -500,6 +503,9 @@ public class Connection extends AbstractExecutionThreadService implements Servic
                                        eventBus.post(new MotdReceived(this, motd.toString()));
                                        motd.setLength(0);
 
+                               } else if (command.equals("KICK")) {
+                                       eventBus.post(new KickedFromChannel(this, parameters.get(0), reply.source().get(), parameters.get(1), getOptional(parameters, 2)));
+
                                /* okay, everything else. */
                                } else {
                                        eventBus.post(new UnknownReplyReceived(this, reply));