events: Add {RoomGuestAccessEvent, SyncRoomGuestAccessEvent}::guest_access

This commit is contained in:
Jonas Platte 2022-04-13 15:34:42 +02:00
parent ea832d0c45
commit cfc5c6e88f
No known key found for this signature in database
GPG Key ID: BBA95679259D342F

View File

@ -28,6 +28,26 @@ impl RoomGuestAccessEventContent {
}
}
impl RoomGuestAccessEvent {
/// Obtain the guest access policy, regardless of whether this event is redacted.
pub fn guest_access(&self) -> &GuestAccess {
match self {
Self::Original(ev) => &ev.content.guest_access,
Self::Redacted(_) => &GuestAccess::Forbidden,
}
}
}
impl SyncRoomGuestAccessEvent {
/// Obtain the guest access policy, regardless of whether this event is redacted.
pub fn guest_access(&self) -> &GuestAccess {
match self {
Self::Original(ev) => &ev.content.guest_access,
Self::Redacted(_) => &GuestAccess::Forbidden,
}
}
}
/// A policy for guest user access to a room.
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)]