import javax.net.SocketFactory;
import net.pterodactylus.irc.event.ChannelJoined;
+import net.pterodactylus.irc.event.ChannelLeft;
import net.pterodactylus.irc.event.ChannelMessageReceived;
import net.pterodactylus.irc.event.ChannelNicknames;
import net.pterodactylus.irc.event.ChannelNotJoined;
} else if (command.equals("366")) {
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)));
/* common channel join errors. */
} else if (command.equals("474")) {
--- /dev/null
+/*
+ * XdccDownloader - ChannelLeft.java - Copyright © 2013 David Roden
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package net.pterodactylus.irc.event;
+
+import net.pterodactylus.irc.Connection;
+import net.pterodactylus.irc.Source;
+
+/**
+ * Event that notifies a listener that a client has left a channel.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class ChannelLeft extends AbstractChannelEvent {
+
+ /** The parting client. */
+ private final Source client;
+
+ /** The message given by the client. */
+ private final String message;
+
+ /**
+ * Creates a new channel joined event.
+ *
+ * @param connection
+ * The connection that joined the channel
+ * @param channel
+ * The channel being left
+ * @param message
+ * The message given by the client
+ */
+ public ChannelLeft(Connection connection, String channel, Source client, String message) {
+ super(connection, channel);
+ this.client = client;
+ this.message = message;
+ }
+
+ //
+ // ACCESSORS
+ //
+
+ /**
+ * Returns the client that joined the channel.
+ *
+ * @return The client that joined the channel
+ */
+ public Source client() {
+ return client;
+ }
+
+ /**
+ * Returns the message given by the client.
+ *
+ * @return The message given by the client
+ */
+ public String message() {
+ return message;
+ }
+
+}