mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
fix: consolidate audited dev updates
This commit is contained in:
1 parent
568b8fd8be
commit
0a552f7ee8
58 files changed
+1930
-132
No files matched your search
@@ -5,7 +5,8 @@ type DirectoryDelta =
|
||||
| { type: "clientEnter"; info: ClientInfo }
|
||||
| { type: "clientLeave"; id: number }
|
||||
| { type: "clientMoved"; id: number; channelID: bigint }
|
||||
| { type: "clientUpdated"; info: DirectoryClientInfo };
|
||||
| { type: "clientUpdated"; info: DirectoryClientInfo }
|
||||
| { type: "clientListSnapshot"; clients: DirectoryClientInfo[] };
|
||||
|
||||
/**
|
||||
* Merges staged welcome snapshots with events received while the snapshot is
|
||||
@@ -52,6 +53,10 @@ export class DirectorySynchronizer {
|
||||
this.applyOrQueue({ type: "clientUpdated", info });
|
||||
}
|
||||
|
||||
applyClientListSnapshot(clients: DirectoryClientInfo[]): void {
|
||||
this.applyOrQueue({ type: "clientListSnapshot", clients });
|
||||
}
|
||||
|
||||
getSnapshot(): TSDirectorySnapshot | null {
|
||||
if (!this.snapshot) return null;
|
||||
return {
|
||||
@@ -92,6 +97,15 @@ export class DirectorySynchronizer {
|
||||
this.clients.set(delta.info.id, current ? { ...current, ...delta.info } : delta.info);
|
||||
return;
|
||||
}
|
||||
if (delta.type === "clientListSnapshot") {
|
||||
for (const info of delta.clients) {
|
||||
const current = this.clients.get(info.id);
|
||||
// A refresh enriches known members; it must not resurrect someone who
|
||||
// left while the asynchronous list request was in flight.
|
||||
if (current && !this.departedClientIds.has(info.id)) this.clients.set(info.id, { ...current, ...info });
|
||||
}
|
||||
return;
|
||||
}
|
||||
const current = this.clients.get(delta.id);
|
||||
if (current) this.clients.set(delta.id, { ...current, channelID: delta.channelID });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user