X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Firc%2FConnection.java;h=d12cc77926b63881b33d2044a5d0154a455ad32d;hb=3ecc370cb08ba0bbe12655dd5339a21cbba698f1;hp=9d9ef726f2aa8cf7e32ddfa85641fb7ba074f117;hpb=85ac475193f3f99d543acbcdb0f04bf3ad23369f;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index 9d9ef72..d12cc77 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -45,6 +45,7 @@ import net.pterodactylus.irc.connection.Handler; import net.pterodactylus.irc.connection.MessageHandler; import net.pterodactylus.irc.connection.MotdHandler; import net.pterodactylus.irc.connection.PrefixHandler; +import net.pterodactylus.irc.connection.SimpleCommandHandler; import net.pterodactylus.irc.event.ChannelJoined; import net.pterodactylus.irc.event.ChannelLeft; import net.pterodactylus.irc.event.ChannelTopic; @@ -368,6 +369,9 @@ public class Connection extends AbstractExecutionThreadService implements Servic new MessageHandler(eventBus, this, prefixHandler), new CtcpHandler(eventBus, this), new ChannelNickHandler(eventBus, this, prefixHandler), + new SimpleCommandHandler() + .addCommand("431", (parameters) -> eventBus.post( + new NoNicknameGivenReceived(this))), new MotdHandler(eventBus, this), new ChannelNotJoinedHandler(eventBus, this), new ConnectionEstablishHandler(eventBus, this), @@ -389,9 +393,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic } /* 43x replies are for nick change errors. */ - if (command.equals("431")) { - eventBus.post(new NoNicknameGivenReceived(this, reply)); - } else if (command.equals("433")) { + if (command.equals("433")) { if (!established.get()) { nickname = nicknameChooser.getNickname(); connectionHandler.sendCommand("NICK", nickname);