libkazv
|
Represent a m.power_levels event. More...
#include <power-levels-desc.hpp>
Classes | |
struct | Private |
Public Member Functions | |
PowerLevelsDesc (const Event &e) | |
Construct a PowerLevelsDesc from an event. More... | |
~PowerLevelsDesc () | |
KAZV_DECLARE_COPYABLE (PowerLevelsDesc) | |
PowerLevel | powerLevelOfUser (std::string userId) const |
Get the power level of a user in the room. More... | |
bool | canSendMessage (std::string userId, std::string eventType) const |
Determine whether a user can send a non-state event. More... | |
bool | canSendState (std::string userId, std::string eventType) const |
Determine whether a user can send a state event. More... | |
bool | canInvite (std::string userId) const |
Determine whether a user can invite someone else. More... | |
bool | canKick (std::string userId) const |
Determine whether a user can kick someone else. More... | |
bool | canBan (std::string userId) const |
Determine whether a user can ban someone else. More... | |
bool | canRedact (std::string userId) const |
Determine whether a user can redact someone else's events. More... | |
Event | normalizedEvent () const |
Get the normalized event of this. More... | |
Event | originalEvent () const |
Get the original event provided when constructing this. More... | |
PowerLevelsDesc | setBan (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to ban someone. More... | |
PowerLevelsDesc | setInvite (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to invite someone. More... | |
PowerLevelsDesc | setKick (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to kick someone. More... | |
PowerLevelsDesc | setRedact (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to redact someone else's messages. More... | |
PowerLevelsDesc | setEvent (std::string eventType, std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to send an event of a particular type. More... | |
PowerLevelsDesc | setEventsDefault (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to send a non-state event whose type is not in events . More... | |
PowerLevelsDesc | setStateDefault (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level needed to send a state event whose type is not in events . More... | |
PowerLevelsDesc | setUser (std::string userId, std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the power level of some user. More... | |
PowerLevelsDesc | setUsersDefault (std::optional< PowerLevel > powerLevel) const |
Amend the power levels event to set the default power level for users. More... | |
Represent a m.power_levels event.
Kazv::PowerLevelsDesc::PowerLevelsDesc | ( | const Event & | e | ) |
Construct a PowerLevelsDesc from an event.
|
default |
bool Kazv::PowerLevelsDesc::canBan | ( | std::string | userId | ) | const |
Determine whether a user can ban someone else.
userId | The id of the user. |
bool Kazv::PowerLevelsDesc::canInvite | ( | std::string | userId | ) | const |
Determine whether a user can invite someone else.
userId | The id of the user. |
bool Kazv::PowerLevelsDesc::canKick | ( | std::string | userId | ) | const |
Determine whether a user can kick someone else.
userId | The id of the user. |
bool Kazv::PowerLevelsDesc::canRedact | ( | std::string | userId | ) | const |
Determine whether a user can redact someone else's events.
userId | The id of the user. |
bool Kazv::PowerLevelsDesc::canSendMessage | ( | std::string | userId, |
std::string | eventType | ||
) | const |
Determine whether a user can send a non-state event.
userId | The id of the user. |
eventType | The type of the event to send. |
bool Kazv::PowerLevelsDesc::canSendState | ( | std::string | userId, |
std::string | eventType | ||
) | const |
Determine whether a user can send a state event.
userId | The id of the user. |
eventType | The type of the event to send. |
Kazv::PowerLevelsDesc::KAZV_DECLARE_COPYABLE | ( | PowerLevelsDesc | ) |
Event Kazv::PowerLevelsDesc::normalizedEvent | ( | ) | const |
Get the normalized event of this.
Event Kazv::PowerLevelsDesc::originalEvent | ( | ) | const |
Get the original event provided when constructing this.
PowerLevel Kazv::PowerLevelsDesc::powerLevelOfUser | ( | std::string | userId | ) | const |
Get the power level of a user in the room.
userId | The id of the user. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setBan | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the power level needed to ban someone.
powerLevel | The new power level needed to ban someone. Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setEvent | ( | std::string | eventType, |
std::optional< PowerLevel > | powerLevel | ||
) | const |
Amend the power levels event to set the power level needed to send an event of a particular type.
eventType | The type of the event. |
powerLevel | The new power level needed to send an event of this type. Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setEventsDefault | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the power level needed to send a non-state event whose type is not in events
.
powerLevel | The new power level needed to send a non-state event of a type not in events . Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setInvite | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the power level needed to invite someone.
powerLevel | The new power level needed to invite someone. Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setKick | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the power level needed to kick someone.
powerLevel | The new power level needed to kick someone. Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setRedact | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the power level needed to redact someone else's messages.
powerLevel | The new power level needed to redact someone else's messages. Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setStateDefault | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the power level needed to send a state event whose type is not in events
.
powerLevel | The new power level needed to send a state event of a type not in events . Use std::nullopt to remove. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setUser | ( | std::string | userId, |
std::optional< PowerLevel > | powerLevel | ||
) | const |
Amend the power levels event to set the power level of some user.
userId | The id of the user. |
powerLevel | The new power level of this user. |
PowerLevelsDesc Kazv::PowerLevelsDesc::setUsersDefault | ( | std::optional< PowerLevel > | powerLevel | ) | const |
Amend the power levels event to set the default power level for users.
powerLevel | The new default power level for users in the room. Use std::nullopt to remove. |