mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-12-11 00:31:26 -05:00
lib/client: always request sasl cap when available
This will allow us to issue post-registration SASL commands.
This commit is contained in:
parent
86b08296a0
commit
4f927b5536
1 changed files with 9 additions and 10 deletions
|
@ -13,6 +13,7 @@ const permanentCaps = [
|
|||
"labeled-response",
|
||||
"message-tags",
|
||||
"multi-prefix",
|
||||
"sasl",
|
||||
"server-time",
|
||||
"setname",
|
||||
|
||||
|
@ -542,10 +543,14 @@ export default class Client extends EventTarget {
|
|||
return saslCap.split(",").includes(mech);
|
||||
}
|
||||
|
||||
requestCaps(extra) {
|
||||
let reqCaps = extra || [];
|
||||
requestCaps() {
|
||||
let wantCaps = [].concat(permanentCaps);
|
||||
if (!this.params.bouncerNetwork) {
|
||||
wantCaps.push("soju.im/bouncer-networks-notify");
|
||||
}
|
||||
|
||||
permanentCaps.forEach((cap) => {
|
||||
let reqCaps = [];
|
||||
wantCaps.forEach((cap) => {
|
||||
if (this.availableCaps[cap] !== undefined && !this.enabledCaps[cap]) {
|
||||
reqCaps.push(cap);
|
||||
}
|
||||
|
@ -566,19 +571,13 @@ export default class Client extends EventTarget {
|
|||
if (args[0] != "*") {
|
||||
console.log("Available server caps:", this.availableCaps);
|
||||
|
||||
let reqCaps = [];
|
||||
let capEnd = true;
|
||||
if ((this.params.saslPlain && this.supportsSASL("PLAIN")) || (this.params.saslExternal && this.supportsSASL("EXTERNAL"))) {
|
||||
// CAP END is deferred after authentication finishes
|
||||
reqCaps.push("sasl");
|
||||
capEnd = false;
|
||||
}
|
||||
|
||||
if (!this.params.bouncerNetwork && this.availableCaps["soju.im/bouncer-networks-notify"] !== undefined) {
|
||||
reqCaps.push("soju.im/bouncer-networks-notify");
|
||||
}
|
||||
|
||||
this.requestCaps(reqCaps);
|
||||
this.requestCaps();
|
||||
|
||||
if (this.status != Client.Status.REGISTERED && capEnd) {
|
||||
this.send({ command: "CAP", params: ["END"] });
|
||||
|
|
Loading…
Reference in a new issue