Address whisper replies to the exact sending connection

This commit is contained in:
omar committed 2026-11-27 16:37:23 +03:00
1 parent 9c0ddd48ca
commit 149bad248e
5 files changed
+25 -8

No files matched your search

+1
View File
@@ -3,6 +3,7 @@
## Unreleased ## Unreleased
- Whisper history and notifications use the sender captured at receipt. A guest who later receives the same client number cannot inherit the original guest's reply action. - Whisper history and notifications use the sender captured at receipt. A guest who later receives the same client number cannot inherit the original guest's reply action.
- Reply Whisper addresses only the connection that sent the whisper, even when a second client is connected with the same UID. Saved whisper lists keep their existing multi-client behavior.
- Channel commanders have a separate indicator in the detailed tree. The compact tree uses the saved commander lamp setting. Only the user's own row offers a commander change, and its confirmation reflects the current server flag. - Channel commanders have a separate indicator in the detailed tree. The compact tree uses the saved commander lamp setting. Only the user's own row offers a commander change, and its confirmation reflects the current server flag.
+2
View File
@@ -4,6 +4,8 @@
## Возврат к разработке на ПК, 2026-11-26 ## Возврат к разработке на ПК, 2026-11-26
Windows, база `9c0ddd4`: обработчик «Ответить на шёпот» передаёт ядру номер и UID именно того подключения, которое прислало шёпот. Два теста прошли: при двух подключениях с одним UID выбран только отправитель; при смене владельца номера до отправки ядро вернуло `no_targets`. Отказ и событие приёма сохранили ожидаемые уведомления. Проверка использовала тестовый список участников, без системной клавиши и сети.
Публикация: повторный push обновил `origin/feature/desktop-parity` с `b685597` до `20240c1`, включая исправления статуса командира и истории шёпота. Отказ аутентификации ниже относится к первой попытке. Публикация: повторный push обновил `origin/feature/desktop-parity` с `b685597` до `20240c1`, включая исправления статуса командира и истории шёпота. Отказ аутентификации ниже относится к первой попытке.
Windows, база `d145043`: история шёпота использует UID отправителя на момент приёма; замена клиента с тем же номером проверена нативным тестом. На закрытом beta14 `duplex_qa --whisper` подтвердил получение с UID, отсутствие звука и события при запрете, возврат приёма и 3/3 отключения. Отдельно прошли тест настройки на двух вкладках, три теста ядра и четыре нативных теста. Системную клавишу ответа не нажимали. Стенд остановлен; push в feature/desktop-parity отклонён при аутентификации. Windows, база `d145043`: история шёпота использует UID отправителя на момент приёма; замена клиента с тем же номером проверена нативным тестом. На закрытом beta14 `duplex_qa --whisper` подтвердил получение с UID, отсутствие звука и события при запрете, возврат приёма и 3/3 отключения. Отдельно прошли тест настройки на двух вкладках, три теста ядра и четыре нативных теста. Системную клавишу ответа не нажимали. Стенд остановлен; push в feature/desktop-parity отклонён при аутентификации.
+1 -1
View File
@@ -358,7 +358,7 @@ pub async fn key_events(ctx:Arc<RuntimeServices>,events:Vec<crate::services::key
if let Some(stop)=stop{ctx.request(&stop.key,stop.command).await?;} if let Some(stop)=stop{ctx.request(&stop.key,stop.command).await?;}
let spec=match event.binding.action{ let spec=match event.binding.action{
A::WhisperList=>{ctx.profile()?.whispers.get().lists.iter().find(|list|list.list_uuid==event.binding.target).map(|list|list.target()).ok_or_else(||ServiceError::new("whisper_missing","Choose an existing whisper list"))?}, A::WhisperList=>{ctx.profile()?.whispers.get().lists.iter().find(|list|list.list_uuid==event.binding.target).map(|list|list.target()).ok_or_else(||ServiceError::new("whisper_missing","Choose an existing whisper list"))?},
A::ReplyWhisper=>{let(id,uid)=super::local_actions::last_whisperer(&ctx,&key)?.ok_or_else(||ServiceError::new("whisper_missing","No received whisper to reply to"))?;let _=id;teamspeach_core::whisper::TargetSpec::List{entries:vec![teamspeach_core::whisper::Entry{kind:1,uuid:uid,name:String::new()}]}}, A::ReplyWhisper=>super::local_actions::reply_target(&ctx,&key)?,
_=>{let pending=ctx.settings_status.lock().map_err(|_|changed())?.pending_whisper.clone().filter(|(session,_)|session==&key).map(|(_,entry)|entry).ok_or_else(||ServiceError::new("whisper_target_required","Choose a quick-whisper target explicitly before holding this shortcut"))?;teamspeach_core::whisper::TargetSpec::List{entries:vec![teamspeach_core::whisper::Entry{kind:pending.kind,uuid:pending.uuid,name:pending.name}]}} _=>{let pending=ctx.settings_status.lock().map_err(|_|changed())?.pending_whisper.clone().filter(|(session,_)|session==&key).map(|(_,entry)|entry).ok_or_else(||ServiceError::new("whisper_target_required","Choose a quick-whisper target explicitly before holding this shortcut"))?;teamspeach_core::whisper::TargetSpec::List{entries:vec![teamspeach_core::whisper::Entry{kind:pending.kind,uuid:pending.uuid,name:pending.name}]}}
}; };
let succeeded=match ctx.request(&key,teamspeach_core::protocol::Command::Whisper(teamspeach_core::whisper::WhisperCommand::Start{epoch:token.epoch,target:spec})).await{Ok(_)=>true,Err(error)=>{ctx.effect(UiEffect::Error(error)).await?;false}}; let succeeded=match ctx.request(&key,teamspeach_core::protocol::Command::Whisper(teamspeach_core::whisper::WhisperCommand::Start{epoch:token.epoch,target:spec})).await{Ok(_)=>true,Err(error)=>{ctx.effect(UiEffect::Error(error)).await?;false}};
+2 -1
View File
@@ -7,7 +7,8 @@ mod connections;
mod bookmarks; mod bookmarks;
mod people; mod people;
mod whispers; mod whispers;
pub use whispers::{LocalWorkflows,on_control,on_closed,last_whisperer}; pub use whispers::{LocalWorkflows,on_control,on_closed};
pub(super) use whispers::reply_target;
pub use connections::bookmark as connect_bookmark; pub use connections::bookmark as connect_bookmark;
pub(super) use connections::away_command; pub(super) use connections::away_command;
pub(super) use bookmarks::create_from_channel; pub(super) use bookmarks::create_from_channel;
@@ -2,6 +2,7 @@ use super::*;
use std::collections::HashMap; use std::collections::HashMap;
use crate::services::whisper::WhisperEntry; use crate::services::whisper::WhisperEntry;
use crate::ui::settings::{Category,Navigation}; use crate::ui::settings::{Category,Navigation};
use teamspeach_core::whisper::{ClientRef, TargetSpec};
type SessionId=(String,u64,u64); type SessionId=(String,u64,u64);
fn session_id(key:&SessionKey)->SessionId{(key.connection_id.clone(),key.session,key.generation)} fn session_id(key:&SessionKey)->SessionId{(key.connection_id.clone(),key.session,key.generation)}
struct Received {id:u16,uid:String,nickname:String,at:u64} struct Received {id:u16,uid:String,nickname:String,at:u64}
@@ -29,9 +30,11 @@ pub fn on_closed(ctx:&RuntimeServices,key:&SessionKey)->Result<()>{
let mut settings=ctx.settings_status.lock().map_err(|_|bad("Settings state unavailable"))?; let mut settings=ctx.settings_status.lock().map_err(|_|bad("Settings state unavailable"))?;
if settings.pending_whisper.as_ref().is_some_and(|(captured,_)|captured==key){settings.pending_whisper=None;}Ok(()) if settings.pending_whisper.as_ref().is_some_and(|(captured,_)|captured==key){settings.pending_whisper=None;}Ok(())
} }
pub fn last_whisperer(ctx:&RuntimeServices,key:&SessionKey)->Result<Option<(u16,String)>>{ pub(in crate::app::runtime) fn reply_target(ctx:&RuntimeServices,key:&SessionKey)->Result<TargetSpec>{
ctx.require_key(key,true)?;let snapshots=ctx.connected.connections.snapshot();let snapshot=snapshots.get(&key.connection_id).filter(|s|s.key==*key&&s.is_connected()).and_then(|s|s.server.as_deref()).ok_or_else(changed)?; ctx.require_key(key,true)?;let snapshots=ctx.connected.connections.snapshot();let snapshot=snapshots.get(&key.connection_id).filter(|s|s.key==*key&&s.is_connected()).and_then(|s|s.server.as_deref()).ok_or_else(changed)?;
Ok(ctx.local_workflows.lock().map_err(|_|bad("Whisper history unavailable"))?.history.get(&session_id(key)).and_then(|entries|entries.iter().rev().find(|entry|peer(snapshot,entry.id,&entry.uid).is_some())).map(|entry|(entry.id,entry.uid.clone()))) let workflows=ctx.local_workflows.lock().map_err(|_|bad("Whisper history unavailable"))?;
let sender=workflows.history.get(&session_id(key)).and_then(|entries|entries.iter().rev().find(|entry|peer(snapshot,entry.id,&entry.uid).is_some()));
Ok(TargetSpec::Ids { clients: sender.into_iter().map(|entry|ClientRef{id:entry.id,uid:Some(entry.uid.clone())}).collect(), channel_ids: Vec::new() })
} }
pub(super) async fn handle(ctx:Arc<RuntimeServices>,target:Target,operation:Operation,_values:Values)->Result<WorkflowResult>{ pub(super) async fn handle(ctx:Arc<RuntimeServices>,target:Target,operation:Operation,_values:Values)->Result<WorkflowResult>{
ctx.require_target(&target)?;let key=key(&target)?;ctx.require_key(&key,true)?; ctx.require_target(&target)?;let key=key(&target)?;ctx.require_key(&key,true)?;
@@ -101,11 +104,21 @@ async fn received_whisper_identity_survives_recycled_client_id() {
// The receipt can reach history before the first roster is available there. // The receipt can reach history before the first roster is available there.
on_control(&ctx, &key, &receipt(key.generation, ORIGINAL, "Original at receipt")).unwrap(); on_control(&ctx, &key, &receipt(key.generation, ORIGINAL, "Original at receipt")).unwrap();
manager.fixture_control(&key, roster(ORIGINAL, "Original renamed")).await.unwrap(); manager.fixture_control(&key, roster(ORIGINAL, "Original renamed")).await.unwrap();
assert_eq!(last_whisperer(&ctx, &key).unwrap(), Some((4, ORIGINAL.into()))); use teamspeach_core::whisper::{ClientView, View, Route, no_targets, resolve, uid_bytes};
let original_uid=uid_bytes(ORIGINAL);
let replacement_uid=uid_bytes(REPLACEMENT);
let mut live=View { server_uid:"FixtureServer=".into(),own_channel:7,channels:vec![],clients:vec![
ClientView{id:4,uid:Some(&original_uid),nickname:"Original",channel:7},
ClientView{id:8,uid:Some(&original_uid),nickname:"Second connection",channel:7},
]};
let pressed=reply_target(&ctx,&key).unwrap();
assert!(matches!(resolve(&pressed,&live).unwrap(), Route::Ids{clients,channels,..} if clients == [4] && channels.is_empty()));
live.clients[0].uid=Some(&replacement_uid);
assert_eq!(resolve(&pressed,&live).unwrap_err(),no_targets());
assert!(rows()[0].actions.iter().all(|action| action.enabled)); assert!(rows()[0].actions.iter().all(|action| action.enabled));
manager.fixture_control(&key, roster(REPLACEMENT, "Replacement")).await.unwrap(); manager.fixture_control(&key, roster(REPLACEMENT, "Replacement")).await.unwrap();
assert_eq!(last_whisperer(&ctx, &key).unwrap(), None); assert_eq!(resolve(&reply_target(&ctx,&key).unwrap(),&live).unwrap_err(),no_targets());
for rejected in [ for rejected in [
json!({"event":"whisper_received", "generation":key.generation, "client_id":4}), json!({"event":"whisper_received", "generation":key.generation, "client_id":4}),
receipt(key.generation, "", "Missing UID"), receipt(key.generation, "", "Missing UID"),
@@ -113,7 +126,7 @@ async fn received_whisper_identity_survives_recycled_client_id() {
receipt(key.generation ^ 1, REPLACEMENT, "Wrong generation"), receipt(key.generation ^ 1, REPLACEMENT, "Wrong generation"),
] { ] {
on_control(&ctx, &key, &rejected).unwrap(); on_control(&ctx, &key, &rejected).unwrap();
assert_eq!(last_whisperer(&ctx, &key).unwrap(), None); assert_eq!(resolve(&reply_target(&ctx,&key).unwrap(),&live).unwrap_err(),no_targets());
} }
let entries = rows(); let entries = rows();
assert_eq!(entries.len(), 1); assert_eq!(entries.len(), 1);
@@ -123,7 +136,7 @@ async fn received_whisper_identity_survives_recycled_client_id() {
assert!(entries[0].actions.iter().all(|action| !action.enabled)); assert!(entries[0].actions.iter().all(|action| !action.enabled));
on_control(&ctx, &key, &receipt(key.generation, REPLACEMENT, "Verified replacement")).unwrap(); on_control(&ctx, &key, &receipt(key.generation, REPLACEMENT, "Verified replacement")).unwrap();
assert_eq!(last_whisperer(&ctx, &key).unwrap(), Some((4, REPLACEMENT.into()))); assert!(matches!(resolve(&reply_target(&ctx,&key).unwrap(),&live).unwrap(), Route::Ids{clients,..} if clients == [4]));
let entries = rows(); let entries = rows();
assert_eq!(entries.len(), 2); assert_eq!(entries.len(), 2);
assert_eq!(entries[0].title, "Verified replacement"); assert_eq!(entries[0].title, "Verified replacement");