From 937126a43e2c65459cba65925907aa6b7afc816e Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 14 Feb 2016 12:08:38 +0200 Subject: [PATCH] Fix #30: Close channel on the client as soon as close event is registered --- src/plugins/inputs/part.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/inputs/part.js b/src/plugins/inputs/part.js index b95083d4..191cbda6 100644 --- a/src/plugins/inputs/part.js +++ b/src/plugins/inputs/part.js @@ -4,17 +4,15 @@ module.exports = function(network, chan, cmd, args) { if (cmd !== "part" && cmd !== "leave" && cmd !== "close") { return; } - var client = this; - if (chan.type === "query") { - network.channels = _.without(network.channels, chan); - client.emit("part", { - chan: chan.id - }); - } else { + if (chan.type !== "query") { var irc = network.irc; if (args.length === 0) { args.push(chan.name); } irc.part(args); } + network.channels = _.without(network.channels, chan); + this.emit("part", { + chan: chan.id + }); };