Merge pull request #2020 from thelounge/xpaw/fix-1991

Wait for server response when parting channels
This commit is contained in:
Jérémie Astori 2018-02-01 00:42:17 -05:00 committed by GitHub
commit 93265ef830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,17 +27,17 @@ exports.input = function(network, chan, cmd, args) {
return; return;
} }
network.channels = _.without(network.channels, target); // If target is not a channel or we are not connected, instantly remove the channel
target.destroy(); // Otherwise send part to the server and wait for response
this.emit("part", { if (target.type !== Chan.Type.CHANNEL || !network.irc || !network.irc.connection || !network.irc.connection.connected) {
chan: target.id, network.channels = _.without(network.channels, target);
}); target.destroy();
this.save(); this.emit("part", {
chan: target.id,
if (target.type === Chan.Type.CHANNEL) { });
if (network.irc) { this.save();
network.irc.part(target.name, partMessage); } else {
} network.irc.part(target.name, partMessage);
} }
return true; return true;