reflectionircd/src/Server.ts

18 lines
529 B
TypeScript
Raw Normal View History

2021-12-05 18:33:49 -05:00
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 {
2021-12-06 10:23:29 -05:00
const maybeUser = this.ircUsers.get(mxid);
if (maybeUser) {
return maybeUser;
}
return new IRCUser(mxid, accessToken, homeserver, this);
2021-12-06 10:23:29 -05:00
}
2021-12-05 18:33:49 -05:00
}