Skip to content

Commit

Permalink
feat(ffi): add history_visibility_override param to the create room fn
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinesp committed Feb 18, 2025
1 parent 6bc9dc5 commit e26bc29
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindings/matrix-sdk-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ use ruma::{
push::{HttpPusherData as RumaHttpPusherData, PushFormat as RumaPushFormat},
OwnedServerName, RoomAliasId, RoomOrAliasId, ServerName,
};
use ruma::events::room::history_visibility::RoomHistoryVisibilityEventContent;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use tokio::sync::broadcast::error::RecvError;
Expand All @@ -88,6 +89,7 @@ use crate::{
utils::AsyncRuntimeDropped,
ClientError,
};
use crate::room::RoomHistoryVisibility;

#[derive(Clone, uniffi::Record)]
pub struct PusherIdentifiers {
Expand Down Expand Up @@ -1400,6 +1402,8 @@ pub struct CreateRoomParameters {
#[uniffi(default = None)]
pub join_rule_override: Option<JoinRule>,
#[uniffi(default = None)]
pub history_visibility_override: Option<RoomHistoryVisibility>,
#[uniffi(default = None)]
pub canonical_alias: Option<String>,
}

Expand Down Expand Up @@ -1447,6 +1451,11 @@ impl TryFrom<CreateRoomParameters> for create_room::v3::Request {
initial_state.push(InitialStateEvent::new(content).to_raw_any());
}

if let Some(history_visibility_override) = value.history_visibility_override {
let content = RoomHistoryVisibilityEventContent::new(history_visibility_override.into());
initial_state.push(InitialStateEvent::new(content).to_raw_any());
}

request.initial_state = initial_state;

if let Some(power_levels) = value.power_level_content_override {
Expand Down

0 comments on commit e26bc29

Please sign in to comment.