mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-12-13 09:41:31 -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",
|
"labeled-response",
|
||||||
"message-tags",
|
"message-tags",
|
||||||
"multi-prefix",
|
"multi-prefix",
|
||||||
|
"sasl",
|
||||||
"server-time",
|
"server-time",
|
||||||
"setname",
|
"setname",
|
||||||
|
|
||||||
|
@ -542,10 +543,14 @@ export default class Client extends EventTarget {
|
||||||
return saslCap.split(",").includes(mech);
|
return saslCap.split(",").includes(mech);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestCaps(extra) {
|
requestCaps() {
|
||||||
let reqCaps = extra || [];
|
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]) {
|
if (this.availableCaps[cap] !== undefined && !this.enabledCaps[cap]) {
|
||||||
reqCaps.push(cap);
|
reqCaps.push(cap);
|
||||||
}
|
}
|
||||||
|
@ -566,19 +571,13 @@ export default class Client extends EventTarget {
|
||||||
if (args[0] != "*") {
|
if (args[0] != "*") {
|
||||||
console.log("Available server caps:", this.availableCaps);
|
console.log("Available server caps:", this.availableCaps);
|
||||||
|
|
||||||
let reqCaps = [];
|
|
||||||
let capEnd = true;
|
let capEnd = true;
|
||||||
if ((this.params.saslPlain && this.supportsSASL("PLAIN")) || (this.params.saslExternal && this.supportsSASL("EXTERNAL"))) {
|
if ((this.params.saslPlain && this.supportsSASL("PLAIN")) || (this.params.saslExternal && this.supportsSASL("EXTERNAL"))) {
|
||||||
// CAP END is deferred after authentication finishes
|
// CAP END is deferred after authentication finishes
|
||||||
reqCaps.push("sasl");
|
|
||||||
capEnd = false;
|
capEnd = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.params.bouncerNetwork && this.availableCaps["soju.im/bouncer-networks-notify"] !== undefined) {
|
this.requestCaps();
|
||||||
reqCaps.push("soju.im/bouncer-networks-notify");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.requestCaps(reqCaps);
|
|
||||||
|
|
||||||
if (this.status != Client.Status.REGISTERED && capEnd) {
|
if (this.status != Client.Status.REGISTERED && capEnd) {
|
||||||
this.send({ command: "CAP", params: ["END"] });
|
this.send({ command: "CAP", params: ["END"] });
|
||||||
|
|
Loading…
Reference in a new issue