From ced5fb2ae01de5fa6f4b8c221d37a5a76ad5b81a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 12 Apr 2013 18:07:01 +0200 Subject: [PATCH] Treat the part message as optional. --- src/main/java/net/pterodactylus/irc/Connection.java | 2 +- src/main/java/net/pterodactylus/irc/event/ChannelLeft.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.7.4