From 51bf8da3d63e2618ecf05379196b7b465737504c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 19 Nov 2021 19:32:13 +0100 Subject: [PATCH] lib/client: don't error out if SASL isn't available on RPL_WELCOME Some servers (soju) might remove the sasl cap on connection registration. --- lib/client.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 89d9ed4..a8c43e4 100644 --- a/lib/client.js +++ b/lib/client.js @@ -58,6 +58,7 @@ export default class Client extends EventTarget { status = Client.Status.DISCONNECTED; serverPrefix = { name: "*" }; nick = null; + supportsCap = false; availableCaps = {}; enabledCaps = {}; isupport = new Map(); @@ -234,7 +235,7 @@ export default class Client extends EventTarget { let k; switch (msg.command) { case irc.RPL_WELCOME: - if (this.params.saslPlain && this.availableCaps["sasl"] === undefined) { + if (this.params.saslPlain && !this.supportsCap) { this.dispatchEvent(new CustomEvent("error", { detail: "Server doesn't support SASL PLAIN" })); this.disconnect(); return; @@ -536,6 +537,7 @@ export default class Client extends EventTarget { let args = msg.params.slice(2); switch (subCmd) { case "LS": + this.supportsCap = true; this.addAvailableCaps(args[args.length - 1]); if (args[0] != "*") { console.log("Available server caps:", this.availableCaps);