From be1d308f9e9743dd059037c3a3e9d8447fb32f80 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 27 Nov 2026 03:14:38 +0300 Subject: [PATCH] Use current channel topology for admin property readback --- CHANGELOG.md | 2 ++ core/src/admin_session.rs | 13 +++++++++---- core/src/snapshot.rs | 26 ++++++++++++++++++++------ docs/bridge.md | 2 +- docs/mobile-port-progress.md | 2 ++ 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 925235d..dbc5dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Channel information and lists now show the current parent and preceding sibling after a neighboring channel moves. + - The server view now names the legacy Speex or CELT codec of the joined channel when voice is unavailable. Browsing another channel does not change the warning. The native transmission gate requires a known Opus codec. - Reapplying direct voice transmission no longer ends an active burst or invalidates captured frames. Switching between direct transmission and voice activation still invalidates the old capture epoch. diff --git a/core/src/admin_session.rs b/core/src/admin_session.rs index 7063b27..8c6184f 100644 --- a/core/src/admin_session.rs +++ b/core/src/admin_session.rs @@ -15,11 +15,14 @@ impl Session { admin::AdminCommand::Context => (menu::command("permissionlist", &[]), admin::Reply::Context), admin::AdminCommand::Extra(admin::extra::Command::ChannelList {}) => { let rows: Vec<_> = snapshot::ordered_channels(&book.channels).into_iter() - .filter_map(|(id, _)| c.extras.channel_properties(id.0).cloned()).collect(); + .filter_map(|(id, _)| { + let channel = book.channels.get(&id)?; + c.extras.channel_properties(id, channel.parent, channel.order) + }).collect(); if rows.len() != book.channels.len() { return Err(ErrorObj::new(ErrorCode::ServerError, "channel properties are incomplete; wait for the server channel list")); } - return Ok(Some(json!({ "rows": rows }))); + return Ok(Some(Value::from_iter([("rows", Value::Array(rows))]))); } admin::AdminCommand::Extra(admin::extra::Command::ChannelInfo { channel_id }) => { if !book.channels.contains_key(&ChannelId(*channel_id)) { @@ -69,8 +72,10 @@ impl Session { let answer = match (reply, res) { (admin::Reply::Context, res) => self.admin_context(res), (admin::Reply::ChannelInfo { channel_id }, Ok(())) => { - self.conn.as_ref().and_then(|c| c.extras.channel_properties(channel_id)) - .map(|row| json!({ "rows": [row] })) + self.conn.as_ref().and_then(|c| { + let channel = c.con.get_state().ok()?.channels.get(&ChannelId(channel_id))?; + c.extras.channel_properties(channel.id, channel.parent, channel.order) + }).map(|row| Value::from_iter([("rows", Value::Array(vec![row]))])) .ok_or_else(|| ErrorObj::new(ErrorCode::NotFound, "channel disappeared before its properties were read")) } (admin::Reply::Rows { notify: "notifyserverupdated", overflow: false, .. }, Ok(())) => { diff --git a/core/src/snapshot.rs b/core/src/snapshot.rs index bed4374..58798af 100644 --- a/core/src/snapshot.rs +++ b/core/src/snapshot.rs @@ -65,10 +65,8 @@ struct ChannelExtra { impl ChannelExtra { fn merge(&mut self, item: &BTreeMap) { for (key, value) in item { - if key.starts_with("channel_") || matches!(key.as_str(), "cid" | "cpid") { + if key == "cid" || (key.starts_with("channel_") && key != "channel_order") { self.properties.insert(key.clone(), value.clone()); - } else if key == "order" { - self.properties.insert("channel_order".into(), value.clone()); } } if let Some(u) = item.get("channel_banner_gfx_url") { @@ -157,9 +155,14 @@ fn non_empty(s: &str) -> Option { (!s.is_empty()).then(|| s.to_owned()) impl RawExtras { pub fn server_properties(&self) -> &BTreeMap { &self.server_properties } - /// Ordinary channel fields observed on this connection, not a ServerQuery snapshot. - pub fn channel_properties(&self, channel_id: u64) -> Option<&BTreeMap> { - self.channels.get(&channel_id).map(|c| &c.properties) + /// The book also relinks siblings that did not receive an individual move notification. + pub fn channel_properties(&self, channel_id: ChannelId, parent: ChannelId, order: ChannelId) -> Option { + let fields = &self.channels.get(&channel_id.0)?.properties; + let mut row = serde_json::Map::with_capacity(fields.len() + 2); + row.extend(fields.iter().map(|(k, v)| (k.clone(), Value::String(v.clone())))); + row.insert("cpid".into(), Value::String(parent.0.to_string())); + row.insert("channel_order".into(), Value::String(order.0.to_string())); + Some(Value::Object(row)) } /// myTeamSpeak avatar URLs of a client (`(variant, url)`), empty if none. pub fn client_myts_avatars(&self, client_id: u16) -> &[(u32, String)] { @@ -516,6 +519,17 @@ mod tests { use super::*; use crate::rawcmd; + #[test] + fn channel_readback_uses_current_sibling_position_and_retains_extra_fields() { + let mut extras = RawExtras::default(); + extras.apply(&rawcmd::parse(b"channellist cid=8 cpid=2 channel_order=3 channel_name=Music channel_banner_mode=2").unwrap()); + extras.apply(&rawcmd::parse(b"notifychanneledited cid=8 channel_topic=Updated").unwrap()); + let row = extras.channel_properties(ChannelId(8), ChannelId(0), ChannelId(7)).unwrap(); + assert_eq!(row, json!({"cid":"8", "cpid":"0", "channel_order":"7", "channel_name":"Music", "channel_banner_mode":"2", "channel_topic":"Updated"})); + extras.apply(&rawcmd::parse(b"notifychanneldeleted cid=8").unwrap()); + assert!(extras.channel_properties(ChannelId(8), ChannelId(0), ChannelId(0)).is_none()); + } + #[test] fn file_backend_and_snapshot_follow_complete_capability_announcements() { use crate::file_transfer::{Files, ListBackend}; diff --git a/docs/bridge.md b/docs/bridge.md index 736252f..4b0bc8d 100644 --- a/docs/bridge.md +++ b/docs/bridge.md @@ -671,7 +671,7 @@ For an isolated Windows beta14 fixture at `127.0.0.1:19987`, set `TEAMSPEACH_QA_ | `channel_delete` | `{generation,channel_id,force,confirm}`; confirm exact current channel name | | `channel_subscribe` / `channel_subscribe_all` | `{channel_id,subscribe}` / `{subscribe}` | | `channel_description` | `{channel_id}` → `{description}` | -| `channel_list` / `channel_info` | `{}` / `{channel_id}`; observed channel wire properties, info refreshes description | +| `channel_list` / `channel_info` | `{}` / `{channel_id}`; observed channel properties, with `cpid` and `channel_order` taken from the current channel tree as decimal strings; info refreshes description | | `client_info` | `{client_id,uid}`; checks current UID, requests `clientgetvariables` | | `set_away` | `{away,message?}`; message only when away, ≤80 characters | | `talk_request` | `{request,message?}`; message only when requesting, ≤50 characters | diff --git a/docs/mobile-port-progress.md b/docs/mobile-port-progress.md index 647eca3..f12ac9c 100644 --- a/docs/mobile-port-progress.md +++ b/docs/mobile-port-progress.md @@ -4,6 +4,8 @@ ## Возврат к разработке на ПК, 2026-11-26 +Windows, база `981c486`: ответы `channel_list` и `channel_info` берут родителя и предыдущий соседний канал из актуальной модели дерева. Адресный тест `channel_readback_uses_current_sibling_position_and_retains_extra_fields` прошёл: сохранены дополнительные свойства, позиция обновлена, удалённый канал не возвращается. Живое перемещение и показ позиции в окне в этом прогоне не проверялись. + Windows, база `827f2c3`: окно сервера показывает название Speex/CELT по текущему каналу открытой вкладки. Прошли `codec_warning_follows_joined_channel_on_viewed_tab` и `legacy_codecs_neither_select_an_encoder_nor_enter_the_mix`. Снимки для окна тестовые; пункт живого входа в legacy-канал остаётся открытым. Windows, база `ced85a3`: при отзыве захвата менеджер один раз инвалидирует каждое затронутое ядро; инвалидация сама ставит маркер конца реплики. Два теста нативного менеджера и три теста очереди и буфера VAD прошли. Запоздалое подтверждение не восстановило отозванный маршрут, новое подтверждение разрешило следующий кадр. Это проверка встроенного ядра, не измерение сетевого или акустического окончания реплики.