From 30595ed23f56db0a6677397fceadbf6d02fb7b0c Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 30 Dec 2019 12:06:54 +0200 Subject: [PATCH] Display the original sets mode string Fixes #675 --- src/plugins/irc-events/mode.js | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/plugins/irc-events/mode.js b/src/plugins/irc-events/mode.js index 1783337c..a3c927a0 100644 --- a/src/plugins/irc-events/mode.js +++ b/src/plugins/irc-events/mode.js @@ -34,7 +34,7 @@ module.exports = function(irc, network) { const msg = new Msg({ type: Msg.Type.MODE_CHANNEL, - text: `${data.raw_modes} ${data.raw_params}`, + text: `${data.raw_modes} ${data.raw_params.join(" ")}`, }); targetChan.pushMessage(client, msg); }); @@ -52,6 +52,15 @@ module.exports = function(irc, network) { } } + const msg = new Msg({ + time: data.time, + type: Msg.Type.MODE, + from: targetChan.getUser(data.nick), + text: `${data.raw_modes} ${data.raw_params.join(" ")}`, + self: data.nick === irc.user.nick, + }); + targetChan.pushMessage(client, msg); + let usersUpdated; const userModeSortPriority = {}; const supportsMultiPrefix = network.irc.network.cap.isEnabled("multi-prefix"); @@ -61,28 +70,14 @@ module.exports = function(irc, network) { }); data.modes.forEach((mode) => { - let text = mode.mode; - const add = text[0] === "+"; - const char = text[1]; + const add = mode.mode[0] === "+"; + const char = mode.mode[1]; if (char === "k") { targetChan.key = add ? mode.param : ""; client.save(); } - if (mode.param) { - text += " " + mode.param; - } - - const msg = new Msg({ - time: data.time, - type: Msg.Type.MODE, - from: targetChan.getUser(data.nick), - text: text, - self: data.nick === irc.user.nick, - }); - targetChan.pushMessage(client, msg); - if (!mode.param) { return; }