diff --git a/bindings/matrix-sdk-ffi/src/room_info.rs b/bindings/matrix-sdk-ffi/src/room_info.rs index 8e89584a001..bff6fd4886e 100644 --- a/bindings/matrix-sdk-ffi/src/room_info.rs +++ b/bindings/matrix-sdk-ffi/src/room_info.rs @@ -53,6 +53,8 @@ pub struct RoomInfo { /// Events causing mentions/highlights for the user, according to their /// notification settings. num_unread_mentions: u64, + /// The currently pinned event ids + pinned_event_ids: Vec, } impl RoomInfo { @@ -64,6 +66,7 @@ impl RoomInfo { for (id, level) in power_levels_map.iter() { user_power_levels.insert(id.to_string(), *level); } + let pinned_event_ids = room.pinned_events().get().iter().map(|id| id.to_string()).collect(); Ok(Self { id: room.room_id().to_string(), @@ -109,6 +112,7 @@ impl RoomInfo { num_unread_messages: room.num_unread_messages(), num_unread_notifications: room.num_unread_notifications(), num_unread_mentions: room.num_unread_mentions(), + pinned_event_ids, }) } } diff --git a/bindings/matrix-sdk-ffi/src/timeline/mod.rs b/bindings/matrix-sdk-ffi/src/timeline/mod.rs index 8ad1df9585c..5102b06e2b7 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/mod.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/mod.rs @@ -651,6 +651,16 @@ impl Timeline { )), } } + + async fn pin_event(&self, event_id_str: String) -> Result { + let event_id = EventId::parse(event_id_str).map_err(ClientError::from)?; + self.inner.pin_event(&event_id).await.map_err(ClientError::from) + } + + async fn unpin_event(&self, event_id_str: String) -> Result { + let event_id = EventId::parse(event_id_str).map_err(ClientError::from)?; + self.inner.unpin_event(&event_id).await.map_err(ClientError::from) + } } #[derive(uniffi::Object)]