From d96704835a31407affefc4b1eed28302dc80b8a0 Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Tue, 6 Jul 2021 15:48:01 +0000 Subject: [PATCH] Send all modes in case of no ISUPPORT --- src/plugins/inputs/mode.js | 2 +- test/commands/mode.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/inputs/mode.js b/src/plugins/inputs/mode.js index 9af07079..30f90531 100644 --- a/src/plugins/inputs/mode.js +++ b/src/plugins/inputs/mode.js @@ -42,7 +42,7 @@ exports.input = function ({irc, nick}, chan, cmd, args) { devoice: "-v", }[cmd]; - const limit = parseInt(irc.network.supports("MODES")) || 1; + const limit = parseInt(irc.network.supports("MODES")) || target.length; for (let i = 0; i < target.length; i += limit) { const targets = target.slice(i, i + limit); diff --git a/test/commands/mode.js b/test/commands/mode.js index 731dcc5e..a818135a 100644 --- a/test/commands/mode.js +++ b/test/commands/mode.js @@ -118,12 +118,14 @@ describe("Commands", function () { expect(testableNetwork.lastCommand).to.equal("MODE #thelounge -v thelounge"); }); - it("should fallback to default limit of 1 mode for shorthand commands", function () { + it("should fallback to all modes at once for shorthand commands", function () { ModeCommand.input(testableNetworkNoSupports, channel, "voice", ["xPaw"]); expect(testableNetworkNoSupports.lastCommand).to.equal("MODE #thelounge +v xPaw"); ModeCommand.input(testableNetworkNoSupports, channel, "devoice", ["xPaw", "Max-P"]); - expect(testableNetworkNoSupports.lastCommand).to.equal("MODE #thelounge -v Max-P"); + expect(testableNetworkNoSupports.lastCommand).to.equal( + "MODE #thelounge -vv xPaw Max-P" + ); }); }); });