From 684e597529603d410b194080b0ae308f1fe57a5e Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 6 Aug 2026 02:33:55 +0200 Subject: [PATCH] Fix Server/Channel Gruppen lists: read from book state instead of waiting for a reply that never arrives notifyservergrouplist/notifychannelgrouplist never surface as an InMessage the connector can match on - the server delivers them as book-state PropertyAdded events (populating con.server_groups / con.channel_groups), while the command's MessageResult itself comes back Ok(()) with no payload. The connector was waiting on the wrong stream item, so the group lists silently never resolved for any account, not just permission-limited ones - confirmed via live debug logging against the real server with a full Server Admin identity. Fix: once the servergrouplist/channelgrouplist command result comes back Ok, read the groups straight out of the already-synced book state instead of trying to match a reply that never comes. --- connector/src/main.rs | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/connector/src/main.rs b/connector/src/main.rs index 10d046d..a194907 100644 --- a/connector/src/main.rs +++ b/connector/src/main.rs @@ -1809,9 +1809,6 @@ async fn run(args: Args) -> Result<()> { }, LoopOutcome::ConEvent(ev) => match ev { Some(Ok(StreamItem::BookEvents(events))) => { - if pending_channel_group_list || pending_server_group_list { - eprintln!("DEBUG BookEvents while pending group list: {events:?}"); - } for event in &events { if let BookEvent::Message { target, invoker, message } = event { match target { @@ -1921,9 +1918,6 @@ async fn run(args: Args) -> Result<()> { } } Some(Ok(StreamItem::MessageResult(handle, result))) => { - if pending_channel_group_list || pending_server_group_list { - eprintln!("DEBUG MessageResult while pending group list: handle={handle:?} result={result:?}"); - } if let Some(label) = pending_messages.remove(&handle) { if let Err(e) = result { if e.missing_permission.is_some() { @@ -1933,13 +1927,37 @@ async fn run(args: Args) -> Result<()> { } else { emit(&Event::Error { message: format!("{label} failed: {e}") }); } + pending_channel_group_list = false; + pending_server_group_list = false; + } else if label == "Channel group list" && pending_channel_group_list { + // The server never sends this back as a notifychannelgrouplist + // reply we can match on InMessage - it arrives as book-state + // PropertyAdded events instead, already applied to the connection by the + // time this Ok(()) shows up, so read the groups straight out of + // book state instead of waiting for a reply that never comes. + let state = con.get_state()?; + let mut entries: Vec = state + .channel_groups + .values() + .map(|g| GroupEntry { id: g.id.0, name: g.name.clone() }) + .collect(); + entries.sort_by_key(|g| g.id); + emit(&Event::ChannelGroupList { entries }); + pending_channel_group_list = false; + } else if label == "Server group list" && pending_server_group_list { + let state = con.get_state()?; + let mut entries: Vec = state + .server_groups + .values() + .map(|g| GroupEntry { id: g.id.0, name: g.name.clone() }) + .collect(); + entries.sort_by_key(|g| g.id); + emit(&Event::ServerGroupList { entries }); + pending_server_group_list = false; } } } Some(Ok(StreamItem::MessageEvent(msg))) => { - if pending_channel_group_list || pending_server_group_list { - eprintln!("DEBUG MessageEvent while pending group list: {msg:?}"); - } if pending_server_log { if let InMessage::ServerLog(log) = &msg { let lines: Vec = log.iter().map(|part| part.log.clone()).collect();