Speaking indicator

This commit is contained in:
2026-08-27 17:12:03 +02:00
parent a4d675bda9
commit 7cc7a131c3
+11 -4
View File
@@ -55,11 +55,19 @@ impl Server {
};
drop(clients);
*user.voice.lock().await = Some(crate::server::VoiceConnection {
let mut voice = user.voice.lock().await;
if let Some(voice) = &mut *voice {
voice.addr = addr;
} else {
*voice = Some(crate::server::VoiceConnection {
addr,
channel_id: channel_id.clone(),
last_speaking_sent: Instant::now(),
});
}
drop(voice);
self.relay_voice(&sender_pubkey, &channel_id, payload)
.await?;
@@ -104,11 +112,10 @@ impl Server {
if now.duration_since(voice.last_speaking_sent).as_millis() >= 600 {
for conn in user.connections.lock().await.values() {
let _ = conn
.send(&ClientMethod::Speaking {
conn.send(&ClientMethod::Speaking {
pubkey: crate::crypto::to_string(sender),
})
.await;
.await?;
}
voice.last_speaking_sent = now;