Skip to content

Commit

Permalink
Use a named type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Jan 26, 2024
1 parent 3b1a455 commit d3b732e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/xmppjs/XJSAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const LASTSTANZA_CHECK_MS = 2 * 60000;
const LASTSTANZA_MAXDURATION = 10 * 60000;
const log = new Logger("XmppJsAccount");

type XmppChatJoinComponents = { handle: string }&({room: string, server: string}|{fullRoomName: string})

export class XmppJsAccount implements IBifrostAccount {

get name(): string {
Expand Down Expand Up @@ -54,14 +56,14 @@ export class XmppJsAccount implements IBifrostAccount {
this.lastStanzaTs.set(roomName, Date.now());
return;
}
const handle: string|undefined = this.roomHandles.get(roomName);
const handle = this.roomHandles.get(roomName);
if (!handle) {
// Shouldn't happen, but we must be careful.
return;
}
this.joinChat({
fullRoomName: roomName,
handle: handle,
handle,
}).catch(ex => {
log.warn(`Attempted to join ${roomName} due to a failed self ping, but failed`, ex);
})
Expand Down Expand Up @@ -193,7 +195,7 @@ export class XmppJsAccount implements IBifrostAccount {
}

public async joinChat(
components: { handle: string }&({room: string, server: string}|{fullRoomName: string}),
components: XmppChatJoinComponents,
instance?: IBifrostInstance,
timeout: number = 5000,
setWaiting: boolean = true)
Expand Down

0 comments on commit d3b732e

Please sign in to comment.