Always emit part message (required for logging)

Fixes #2988
This commit is contained in:
Pavel Djundik 2019-01-21 18:07:00 +02:00
parent f49bf19023
commit 02a343624e

View File

@ -13,6 +13,17 @@ module.exports = function(irc, network) {
return;
}
const user = chan.getUser(data.nick);
const msg = new Msg({
type: Msg.Type.PART,
time: data.time,
text: data.message || "",
hostmask: data.ident + "@" + data.hostname,
from: user,
self: data.nick === irc.user.nick,
});
chan.pushMessage(client, msg);
if (data.nick === irc.user.nick) {
network.channels = _.without(network.channels, chan);
chan.destroy();
@ -21,17 +32,6 @@ module.exports = function(irc, network) {
chan: chan.id,
});
} else {
const user = chan.getUser(data.nick);
const msg = new Msg({
type: Msg.Type.PART,
time: data.time,
text: data.message || "",
hostmask: data.ident + "@" + data.hostname,
from: user,
});
chan.pushMessage(client, msg);
chan.removeUser(user);
client.emit("users", {
chan: chan.id,