Proper vc leaving
This commit is contained in:
@@ -219,6 +219,17 @@ export default class Enclave<P = Page> {
|
||||
this.server?.getUsers([msg.pubkey]);
|
||||
return;
|
||||
|
||||
case "UserLeftVoice":
|
||||
if (!server.voiceChatUsers[msg.channel_id]) return;
|
||||
|
||||
server.voiceChatUsers[msg.channel_id] = server.voiceChatUsers[
|
||||
msg.channel_id
|
||||
].filter((v) => v !== msg.pubkey);
|
||||
|
||||
this.forceRender();
|
||||
|
||||
return;
|
||||
|
||||
case "Speaking":
|
||||
clearTimeout(server.voiceChatSpeakers[msg.pubkey]);
|
||||
|
||||
|
||||
@@ -40,6 +40,11 @@ export type ClientMethod =
|
||||
channel_id: string;
|
||||
pubkey: string;
|
||||
}
|
||||
| {
|
||||
method: "UserLeftVoice";
|
||||
channel_id: string;
|
||||
pubkey: string;
|
||||
}
|
||||
| {
|
||||
method: "Speaking";
|
||||
pubkey: string;
|
||||
@@ -89,4 +94,7 @@ export type ServerMethod =
|
||||
| {
|
||||
method: "JoinVoice";
|
||||
channel_id: string;
|
||||
}
|
||||
| {
|
||||
method: "LeaveVoice";
|
||||
};
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ export default class EnclaveServer {
|
||||
public messages: Record<string, Record<string, StoredMessage>>;
|
||||
public users: Record<string, ClientMeta | null>;
|
||||
|
||||
public voiceJoin?: (pin: number, channelId: string) => void;
|
||||
public voiceJoin?: (pin: bigint, channelId: string) => void;
|
||||
public voiceChatUsers: Record<string, string[]>;
|
||||
public voiceChatSpeakers: Record<string, NodeJS.Timeout>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user