diff --git a/bindings/matrix-sdk-ffi/src/timeline/content.rs b/bindings/matrix-sdk-ffi/src/timeline/content.rs index c55bd7961..a8536997f 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/content.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/content.rs @@ -360,6 +360,18 @@ impl From for MembershipChange { } } +#[derive(Clone, uniffi::Record)] +pub struct PowerLevelChanges { + ban: i64, + kick: i64, + events_default: i64, + invite: i64, + redact: i64, + state_default: i64, + users_default: i64, + notifications: i64, +} + #[derive(Clone, uniffi::Enum)] #[allow(clippy::large_enum_variant)] // Added because the RoomPowerLevels variant is quite large. @@ -393,16 +405,10 @@ pub enum OtherState { RoomPowerLevels { events: HashMap, previous_events: Option>, - ban: Option, - kick: Option, - events_default: Option, - invite: Option, - redact: Option, - state_default: Option, - users_default: Option, - notifications: Option, users: HashMap, previous: Option>, + thresholds: Option, + previous_thresholds: Option, }, RoomServerAcl, RoomThirdPartyInvite { @@ -494,14 +500,28 @@ impl From<&matrix_sdk_ui::timeline::AnyOtherFullStateEventContent> for OtherStat .map(|(k, &v)| (k.clone().into(), v.into())) .collect() }), - ban: Some(content.ban.into()), - kick: Some(content.kick.into()), - events_default: Some(content.events_default.into()), - invite: Some(content.invite.into()), - redact: Some(content.redact.into()), - state_default: Some(content.state_default.into()), - users_default: Some(content.users_default.into()), - notifications: Some(content.notifications.room.into()), + thresholds: Some(PowerLevelChanges { + ban: content.ban.into(), + kick: content.kick.into(), + events_default: content.events_default.into(), + invite: content.invite.into(), + redact: content.redact.into(), + state_default: content.state_default.into(), + users_default: content.users_default.into(), + notifications: content.notifications.room.into(), + }), + previous_thresholds: prev_content.as_ref().map(|prev_content| { + PowerLevelChanges { + ban: prev_content.ban.into(), + kick: prev_content.kick.into(), + events_default: prev_content.events_default.into(), + invite: prev_content.invite.into(), + redact: prev_content.redact.into(), + state_default: prev_content.state_default.into(), + users_default: prev_content.users_default.into(), + notifications: prev_content.notifications.room.into(), + } + }), users: power_level_user_changes(content, prev_content) .iter() .map(|(k, v)| (k.to_string(), *v)) @@ -513,16 +533,10 @@ impl From<&matrix_sdk_ui::timeline::AnyOtherFullStateEventContent> for OtherStat FullContent::Redacted(_) => Self::RoomPowerLevels { events: Default::default(), previous_events: None, - ban: None, - kick: None, - events_default: None, - invite: None, - redact: None, - state_default: None, - users_default: None, - notifications: None, users: Default::default(), previous: None, + thresholds: None, + previous_thresholds: None, }, }, Content::RoomServerAcl(_) => Self::RoomServerAcl,