From: David ‘Bombe’ Roden Date: Wed, 15 Oct 2014 19:37:36 +0000 (+0200) Subject: Parse KICK command and send appropriate event. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bf5c410d06c7a354017ebcd321e365b9cd767081;p=xudocci.git Parse KICK command and send appropriate event. --- diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index fb67fe7..70ac0eb 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -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; @@ -500,6 +501,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)); diff --git a/src/main/java/net/pterodactylus/irc/event/KickedFromChannel.java b/src/main/java/net/pterodactylus/irc/event/KickedFromChannel.java new file mode 100644 index 0000000..54b4f67 --- /dev/null +++ b/src/main/java/net/pterodactylus/irc/event/KickedFromChannel.java @@ -0,0 +1,38 @@ +package net.pterodactylus.irc.event; + +import net.pterodactylus.irc.Connection; +import net.pterodactylus.irc.Source; + +import com.google.common.base.Optional; + +/** + * Event that signals that a client was kicked from a channel. + * + * @author David ‘Bombe’ Roden + */ +public class KickedFromChannel extends AbstractChannelEvent { + + private final Source kicker; + private final String kickee; + private final Optional reason; + + public KickedFromChannel(Connection connection, String channel, Source kicker, String kickee, Optional reason) { + super(connection, channel); + this.kicker = kicker; + this.kickee = kickee; + this.reason = reason; + } + + public Source kicker() { + return kicker; + } + + public String kickee() { + return kickee; + } + + public Optional reason() { + return reason; + } + +}