This commit is contained in:
2026-08-27 02:22:56 +02:00
parent 8887c96f05
commit 02a444d6ed
2 changed files with 31 additions and 14 deletions
+28 -11
View File
@@ -49,6 +49,11 @@ pub enum ClientMethod {
pin: u64,
},
UserJoinedVoice {
channel_id: String,
pubkey: String,
},
Speaking {
pubkey: String,
},
@@ -167,19 +172,31 @@ pub async fn read_loop(
}
ServerMethod::JoinVoice { channel_id } => {
let pin = rand::random::<u64>() % (1 << 53);
{
let pin = rand::random::<u64>() % (1 << 53);
server
.voice_pins
.lock()
.await
.insert(pin, (verifying_key, channel_id.clone()));
send_socket(
&mut *socket.lock().await,
&ClientMethod::JoinVoice {
channel_id: channel_id.clone(),
pin,
},
)
.await?;
}
server
.voice_pins
.lock()
.await
.insert(pin, (verifying_key, channel_id.clone()));
send_socket(
&mut *socket.lock().await,
&ClientMethod::JoinVoice { channel_id, pin },
)
.await?;
.broadcast(&ClientMethod::UserJoinedVoice {
channel_id,
pubkey: crate::crypto::to_string(&verifying_key),
})
.await?;
}
}