From: David ‘Bombe’ Roden Date: Fri, 12 Apr 2013 16:07:01 +0000 (+0200) Subject: Treat the part message as optional. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ced5fb2ae01de5fa6f4b8c221d37a5a76ad5b81a;p=xudocci.git Treat the part message as optional. --- diff --git a/src/main/java/net/pterodactylus/irc/Connection.java b/src/main/java/net/pterodactylus/irc/Connection.java index 5b460da..6d21b32 100644 --- a/src/main/java/net/pterodactylus/irc/Connection.java +++ b/src/main/java/net/pterodactylus/irc/Connection.java @@ -391,7 +391,7 @@ public class Connection extends AbstractExecutionThreadService implements Servic eventBus.post(new ChannelNicknames(this, parameters.get(1), nicks)); nicks.clear(); } else if (command.equalsIgnoreCase("PART")) { - eventBus.post(new ChannelLeft(this, parameters.get(0), reply.source().get(), parameters.get(1))); + eventBus.post(new ChannelLeft(this, parameters.get(0), reply.source().get(), getOptional(parameters, 1))); } else if (command.equalsIgnoreCase("QUIT")) { eventBus.post(new ClientQuit(this, reply.source().get(), parameters.get(0))); diff --git a/src/main/java/net/pterodactylus/irc/event/ChannelLeft.java b/src/main/java/net/pterodactylus/irc/event/ChannelLeft.java index e9c52f3..00b088a 100644 --- a/src/main/java/net/pterodactylus/irc/event/ChannelLeft.java +++ b/src/main/java/net/pterodactylus/irc/event/ChannelLeft.java @@ -20,6 +20,8 @@ package net.pterodactylus.irc.event; import net.pterodactylus.irc.Connection; import net.pterodactylus.irc.Source; +import com.google.common.base.Optional; + /** * Event that notifies a listener that a client has left a channel. * @@ -31,7 +33,7 @@ public class ChannelLeft extends AbstractChannelEvent { private final Source client; /** The message given by the client. */ - private final String message; + private final Optional message; /** * Creates a new channel joined event. @@ -43,7 +45,7 @@ public class ChannelLeft extends AbstractChannelEvent { * @param message * The message given by the client */ - public ChannelLeft(Connection connection, String channel, Source client, String message) { + public ChannelLeft(Connection connection, String channel, Source client, Optional message) { super(connection, channel); this.client = client; this.message = message; @@ -67,7 +69,7 @@ public class ChannelLeft extends AbstractChannelEvent { * * @return The message given by the client */ - public String message() { + public Optional message() { return message; }