Handle FAIL ACCOUNT_REQUIRED

This commit is contained in:
Simon Ser 2021-12-06 22:54:15 +01:00
parent 305f510501
commit f9ec578fce

View file

@ -362,7 +362,9 @@ export default class Client extends EventTarget {
}
break;
case "ERROR":
this.dispatchEvent(new CustomEvent("error", { detail: "Fatal IRC error: " + msg.params[0] }));
this.dispatchEvent(new CustomEvent("error", {
detail: "Fatal IRC error: " + msg.params[0],
}));
this.disconnect();
break;
case irc.ERR_PASSWDMISMATCH:
@ -372,15 +374,27 @@ export default class Client extends EventTarget {
case irc.ERR_UNAVAILRESOURCE:
case irc.ERR_NOPERMFORHOST:
case irc.ERR_YOUREBANNEDCREEP:
this.dispatchEvent(new CustomEvent("error", { detail: "Error (" + msg.command + "): " + msg.params[msg.params.length - 1] }));
this.dispatchEvent(new CustomEvent("error", {
detail: "Error (" + msg.command + "): " + msg.params[msg.params.length - 1],
}));
if (this.status != Client.Status.REGISTERED) {
this.disconnect();
}
break;
case "FAIL":
if (this.status === Client.Status.REGISTERED) {
break;
}
let reason = msg.params[msg.params.length - 1];
if (msg.params[0] === "BOUNCER" && msg.params[2] === "BIND") {
this.dispatchEvent(new CustomEvent("error", {
detail: "Failed to bind to bouncer network: " + msg.params[3],
detail: "Failed to bind to bouncer network: " + reason,
}));
this.disconnect();
}
if (msg.params[1] === "ACCOUNT_REQUIRED") {
this.dispatchEvent(new CustomEvent("error", {
detail: reason,
}));
this.disconnect();
}