reflectionircd/src/Server.ts

18 lines
No EOL
529 B
TypeScript

import { IRCUser } from "./IRCUser.js"
export class Server {
public name: string
public ircUsers: Map<string, IRCUser>
constructor(public config: any) {
this.name = this.config.serverName;
this.ircUsers = new Map();
}
getOrCreateIRCUser(mxid: string, accessToken: string, homeserver: string): IRCUser {
const maybeUser = this.ircUsers.get(mxid);
if (maybeUser) {
return maybeUser;
}
return new IRCUser(mxid, accessToken, homeserver, this);
}
}