Fix missing parameter for 900, catch connection error

This commit is contained in:
emerson 2022-02-09 07:54:03 -05:00
parent fa58928ec2
commit 021e2920ab
2 changed files with 6 additions and 8 deletions

View file

@ -188,8 +188,8 @@ export class Client {
this.closeConnectionWithError('access token does not match mxid, please check credentials')
} else {
this.user = thisIRCUser;
this.sendMessage(this.server.name, '900', numerics['900'](this.user.getMask(), this.user.nick));
this.sendMessage(this.server.name, '903', numerics['903'](this.user.nick));
this.sendMessage(this.server.name, '900', [this.user.nick, this.user.getMask(), this.user.accountName, `You are now logged in as ${this.user.nick}`]);
this.sendMessage(this.server.name, '903', [this.user.nick, "SASL authentication successful"]);
if (this.user.isSynced()) {
this.user.addClient(this);
} else {
@ -214,6 +214,10 @@ export class Client {
})
}
}
}).catch((error) => {
console.log(error);
this.sendMessage(this.server.name, '904', numerics['904']('*'))
this.closeConnectionWithError('Error connecting to the Matrix server')
})
}
}

View file

@ -38,12 +38,6 @@ const numerics = {
"433": (nick: string, otherNick: string) => {
return [nick, otherNick, "Nickname is already in use"]
},
"900": (mask: string, nick: string) => {
return [nick, mask, `You are now logged in as ${nick}`]
},
"903": (nick: string) => {
return [nick, "SASL authentication successful"]
},
"904": (nick: string) => {
return [nick, "SASL authentication failed"]
},