diff --git a/Cargo.lock b/Cargo.lock index 7748b20..67c2e29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -532,7 +532,7 @@ dependencies = [ [[package]] name = "chanora_resolver" -version = "0.1.0" +version = "0.2.0-beta.1" dependencies = [ "anyhow", "hickory-resolver", diff --git a/crates/chanora_bridge/src/api.rs b/crates/chanora_bridge/src/api.rs index 6545068..9f989c2 100644 --- a/crates/chanora_bridge/src/api.rs +++ b/crates/chanora_bridge/src/api.rs @@ -1972,27 +1972,77 @@ impl From for BridgeEvent { route: route.into(), } } - chanora_core::SessionEvent::ClientMoved { client_id, new_channel_id } => { - BridgeEvent::ClientMoved { client_id, new_channel_id } - } - chanora_core::SessionEvent::ClientJoined { client_id, channel_id, name, input_muted, output_muted, is_server_query, talk_power, talk_power_granted } => { - BridgeEvent::ClientJoined { client_id, channel_id, name, input_muted, output_muted, is_server_query, talk_power, talk_power_granted } - } + chanora_core::SessionEvent::ClientMoved { + client_id, + new_channel_id, + } => BridgeEvent::ClientMoved { + client_id, + new_channel_id, + }, + chanora_core::SessionEvent::ClientJoined { + client_id, + channel_id, + name, + input_muted, + output_muted, + is_server_query, + talk_power, + talk_power_granted, + } => BridgeEvent::ClientJoined { + client_id, + channel_id, + name, + input_muted, + output_muted, + is_server_query, + talk_power, + talk_power_granted, + }, chanora_core::SessionEvent::ClientLeft { client_id, name } => { BridgeEvent::ClientLeft { client_id, name } } - chanora_core::SessionEvent::ClientUpdated { client_id, input_muted, output_muted, is_server_query, talk_power, talk_power_granted } => { - BridgeEvent::ClientUpdated { client_id, input_muted, output_muted, is_server_query, talk_power, talk_power_granted } - } - chanora_core::SessionEvent::ChannelAdded { id, parent, name, order, has_password, needed_talk_power } => { - BridgeEvent::ChannelAdded { id, parent, name, order, has_password, needed_talk_power } - } - chanora_core::SessionEvent::ChannelRemoved { id } => { - BridgeEvent::ChannelRemoved { id } - } - chanora_core::SessionEvent::ChannelUpdated { id, name, has_password, needed_talk_power } => { - BridgeEvent::ChannelUpdated { id, name, has_password, needed_talk_power } - } + chanora_core::SessionEvent::ClientUpdated { + client_id, + input_muted, + output_muted, + is_server_query, + talk_power, + talk_power_granted, + } => BridgeEvent::ClientUpdated { + client_id, + input_muted, + output_muted, + is_server_query, + talk_power, + talk_power_granted, + }, + chanora_core::SessionEvent::ChannelAdded { + id, + parent, + name, + order, + has_password, + needed_talk_power, + } => BridgeEvent::ChannelAdded { + id, + parent, + name, + order, + has_password, + needed_talk_power, + }, + chanora_core::SessionEvent::ChannelRemoved { id } => BridgeEvent::ChannelRemoved { id }, + chanora_core::SessionEvent::ChannelUpdated { + id, + name, + has_password, + needed_talk_power, + } => BridgeEvent::ChannelUpdated { + id, + name, + has_password, + needed_talk_power, + }, } } } diff --git a/crates/chanora_resolver/Cargo.toml b/crates/chanora_resolver/Cargo.toml index 3526a5f..bd29c50 100644 --- a/crates/chanora_resolver/Cargo.toml +++ b/crates/chanora_resolver/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "chanora_resolver" -version = "0.1.0" -edition = "2021" -license = "MIT OR Apache-2.0" -publish = false +version.workspace = true +edition.workspace = true +license.workspace = true +publish.workspace = true build = "build.rs" [dependencies] diff --git a/crates/chanora_state/src/lib.rs b/crates/chanora_state/src/lib.rs index 978284f..75e618a 100644 --- a/crates/chanora_state/src/lib.rs +++ b/crates/chanora_state/src/lib.rs @@ -346,9 +346,7 @@ pub fn reduce(state: &mut Option, event: StateEvent) -> Reduction { if removed_channel { deltas.push(Delta::ChannelRemoved(id)); } - Reduction { - deltas, - } + Reduction { deltas } } _ => Reduction { deltas: vec![] }, }, @@ -412,14 +410,7 @@ pub fn reduce_reconnect_snapshot( state: &mut Option, snap: ServerSnapshot, ) -> Reduction { - let normalized = normalize_snapshot(snap); - *state = Some(ServerState::from_snapshot(normalized.clone())); - Reduction { - deltas: vec![ - Delta::ConnectionStateChanged(ConnectionState::Ready), - Delta::SnapshotApplied(normalized), - ], - } + reduce(state, StateEvent::Snapshot(snap)) } #[cfg(test)]