mirror of
https://git.sr.ht/~emerson/reflectionircd
synced 2025-08-05 16:59:10 +00:00
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
![]() |
import { Channel } from "./Channel.js";
|
||
|
import { Client } from "./Client.js";
|
||
|
import { MatrixUser } from "./MatrixUser.js";
|
||
|
import { IRCMessage } from "./Message.js";
|
||
|
import { Server } from "./Server.js";
|
||
|
|
||
|
export class IRCUser {
|
||
|
private clients: Set<Client>
|
||
|
private channels: Map<string, Channel>
|
||
|
private server: Server
|
||
|
private matrixUser: MatrixUser|null
|
||
|
public nick: string
|
||
|
private ident: string
|
||
|
private hostname: string
|
||
|
public accountName: string
|
||
|
public isAuthed: boolean
|
||
|
private txnIdStore: Set<string>
|
||
|
constructor(private initialClient: Client, public mxid: string, private accessToken: string) {
|
||
|
this.clients = new Set([initialClient]);
|
||
|
this.channels = new Map();
|
||
|
this.server = initialClient.server;
|
||
|
this.matrixUser = null;
|
||
|
const mxidSplit = mxid.split(':')
|
||
|
this.nick = mxidSplit[0].substr(1);
|
||
|
this.ident = this.nick;
|
||
|
this.hostname = mxidSplit[1];
|
||
|
this.accountName = mxid.slice(1);
|
||
|
this.isAuthed = false;
|
||
|
this.txnIdStore = new Set();
|
||
|
}
|
||
|
|
||
|
verifyCredentials(accessToken: string): boolean {
|
||
|
return accessToken === this.accessToken;
|
||
|
}
|
||
|
}
|