Move kick handling into the simple command handler.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 22 Oct 2014 20:14:45 +0000 (22:14 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 22 Oct 2014 20:14:45 +0000 (22:14 +0200)
src/main/java/net/pterodactylus/irc/Connection.java

index 332b0b1..0e74955 100644 (file)
@@ -387,7 +387,11 @@ public class Connection extends AbstractExecutionThreadService implements Servic
                                                                                        s.get(), getOptional(p, 1)))
                                                        .addCommand("QUIT",
                                                                        (s, p) -> new ClientQuit(this, s.get(),
-                                                                                       p.get(0))),
+                                                                                       p.get(0)))
+                                                       .addCommand("KICK",
+                                                                       (s, p) -> new KickedFromChannel(this,
+                                                                                       p.get(0), s.get(), p.get(1),
+                                                                                       getOptional(p, 2))),
                                        new MotdHandler(eventBus, this),
                                        new ChannelNotJoinedHandler(eventBus, this),
                                        new ConnectionEstablishHandler(eventBus, this),
@@ -425,9 +429,6 @@ public class Connection extends AbstractExecutionThreadService implements Servic
                                } else if (command.equalsIgnoreCase("PING")) {
                                        connectionHandler.sendCommand("PONG", getOptional(parameters, 0), getOptional(parameters, 1));
 
-                               } else if (command.equalsIgnoreCase("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));