[][src]Struct gm_types::content::room::PowerLevels

pub struct PowerLevels {
    pub ban: u32,
    pub events: HashMap<String, u32>,
    pub events_default: u32,
    pub invite: u32,
    pub kick: u32,
    pub redact: u32,
    pub state_default: u32,
    pub users: HashMap<String, u32>,
    pub users_default: u32,
}

m.room.power_levels

This event specifies the minimum level a user must have in order to perform a certain action. It also specifies the levels of each user in the room.

If a user_id is in the users list, then that user_id has the associated power level. Otherwise they have the default level users_default. If users_default is not supplied, it is assumed to be 0.

The level required to send a certain event is governed by events, state_default and events_default. If an event type is specified in events, then the user must have at least the level specified in order to send that event. If the event type is not supplied, it defaults to events_default for Message Events and state_default for State Events.

If there is no state_default in the m.room.power_levels event, the state_default is 50. If there is no events_default in the m.room.power_levels event, the events_default is 0. If the room contains no m.room.power_levels event, both the state_default and events_default are 0.

The power level required to invite a user to the room, kick a user from the room, ban a user from the room, or redact an event, is defined by invite, kick, ban, and redact, respectively. Each of these levels defaults to 50 if they are not specified in the m.room.power_levels event, or if the room contains no m.room.power_levels event.

Fields

ban: u32

The level required to ban a user. Defaults to 50 if unspecified.

events: HashMap<String, u32>

The level required to send specific event types. This is a mapping from event type to power level required.

events_default: u32

The default level required to send message events. Can be overridden by the events key. Defaults to 0 if unspecified.

invite: u32

The level required to invite a user. Defaults to 50 if unspecified.

kick: u32

The level required to kick a user. Defaults to 50 if unspecified.

redact: u32

The level required to redact an event. Defaults to 50 if unspecified.

state_default: u32

The default level required to send state events. Can be overridden by the events key. Defaults to 50 if unspecified, but 0 if there is no m.room.power_levels event at all.

users: HashMap<String, u32>

The power levels for specific users. This is a mapping from user_id to power level for that user.

users_default: u32

The default power level for every user in the room, unless their user_id is mentioned in the users key. Defaults to 0 if unspecified.

Trait Implementations

impl Clone for PowerLevels[src]

impl Debug for PowerLevels[src]

impl<'de> Deserialize<'de> for PowerLevels[src]

impl Serialize for PowerLevels[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.