get basic connection working

This commit is contained in:
emerson 2021-12-05 18:44:21 -05:00
parent 43e974f4c6
commit 4ffe157380
No known key found for this signature in database
GPG key ID: 270669502DA603E3
2 changed files with 11 additions and 2 deletions

View file

@ -87,7 +87,7 @@ export class Client {
const capsToChange = (message.params[1].indexOf(' ') === -1) ? [message.params[1]] : message.params[1].split(' ');
const capsEnabled: string[] = [];
capsToChange.forEach(cap => {
if (cap in this.allCaps) {
if (this.allCaps.get(cap)) {
this.enabledCaps.set(cap, '');
capsEnabled.push(cap);
}
@ -126,14 +126,19 @@ export class Client {
}
else {
this.user = thisIRCUser;
this.sendMessage(this.server.name, '900', numerics['900'](this.user.getMask(), this.user.nick), new Map());
this.sendMessage(this.server.name, '903', numerics['903'](this.user.nick), new Map());
}
}
this.user = thisIRCUser;
this.sendMessage(this.server.name, '900', numerics['900'](this.user.getMask(), this.user.nick), new Map());
this.sendMessage(this.server.name, '903', numerics['903'](this.user.nick), new Map());
}
}
doRegistration(message: IRCMessage) {
if (this.user === null) {
this.closeConnectionWithError('Authentication failed');
this.closeConnectionWithError("You must use SASL to connect to this server");
return;
}
this.sendMessage(this.server.name, '001', numerics['001'](this.user.nick, this.server.name), message.tags);

View file

@ -32,4 +32,8 @@ export class IRCUser {
verifyCredentials(accessToken: string): boolean {
return accessToken === this.accessToken;
}
getMask(): string {
return `${this.nick}!${this.ident}@${this.hostname}`;
}
}