Class RoomPowerLevelsContent
- java.lang.Object
-
- io.github.ma1uta.matrix.event.content.RoomPowerLevelsContent
-
- All Implemented Interfaces:
EventContent
public class RoomPowerLevelsContent extends Object implements EventContent
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. If the room contains no m.room.power_levels event, the room's creator has a power level of 100, and all other users have a power level of 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.
-
-
Field Summary
Fields Modifier and Type Field Description private BytebanThe level required to ban a user.static byteDEFAULT_HIGH_LEVELDefault max level if unspecified.static byteDEFAULT_LOW_LEVELDefault lowest level if unspecified.static byteDEFAULT_MEDIUM_LEVELDefault medium level if unspecified.private Map<String,Byte>eventsThe level required to send specific event types.private ByteeventsDefaultThe default level required to send message events.private ByteinviteThe level required to invite a user.private BytekickThe level required to kick a user.private NotificationPowerLevelnotificationsThe power level requirements for specific notification types.private ByteredactThe level required to redact an event.private BytestateDefaultThe default level required to send state events.private Map<String,Byte>usersThe power levels for specific users.private ByteusersDefaultThe default power level for every user in the room, unless their user_id is mentioned in the users key.
-
Constructor Summary
Constructors Constructor Description RoomPowerLevelsContent()
-
Method Summary
Modifier and Type Method Description BytegetBan()Map<String,Byte>getEvents()BytegetEventsDefault()BytegetInvite()BytegetKick()NotificationPowerLevelgetNotifications()BytegetRedact()BytegetStateDefault()Map<String,Byte>getUsers()BytegetUsersDefault()voidsetBan(Byte ban)voidsetEvents(Map<String,Byte> events)voidsetEventsDefault(Byte eventsDefault)voidsetInvite(Byte invite)voidsetKick(Byte kick)voidsetNotifications(NotificationPowerLevel notifications)voidsetRedact(Byte redact)voidsetStateDefault(Byte stateDefault)voidsetUsers(Map<String,Byte> users)voidsetUsersDefault(Byte usersDefault)
-
-
-
Field Detail
-
DEFAULT_HIGH_LEVEL
public static final byte DEFAULT_HIGH_LEVEL
Default max level if unspecified.- See Also:
- Constant Field Values
-
DEFAULT_MEDIUM_LEVEL
public static final byte DEFAULT_MEDIUM_LEVEL
Default medium level if unspecified.- See Also:
- Constant Field Values
-
DEFAULT_LOW_LEVEL
public static final byte DEFAULT_LOW_LEVEL
Default lowest level if unspecified.- See Also:
- Constant Field Values
-
ban
private Byte ban
The level required to ban a user. Defaults to 50 if unspecified.
-
events
private Map<String,Byte> events
The level required to send specific event types. This is a mapping from event type to power level required.
-
eventsDefault
private Byte eventsDefault
The default level required to send message events. Can be overridden by the events key. Defaults to 0 if unspecified.
-
invite
private Byte invite
The level required to invite a user. Defaults to 50 if unspecified.
-
kick
private Byte kick
The level required to kick a user. Defaults to 50 if unspecified.
-
redact
private Byte redact
The level required to redact an event. Defaults to 50 if unspecified.
-
stateDefault
private Byte stateDefault
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
private Map<String,Byte> users
The power levels for specific users. This is a mapping from user_id to power level for that user.
-
usersDefault
private Byte usersDefault
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.
-
notifications
private NotificationPowerLevel notifications
The power level requirements for specific notification types. This is a mapping from key to power level for that notifications key.
-
-
Method Detail
-
getBan
public Byte getBan()
-
setBan
public void setBan(Byte ban)
-
getEventsDefault
public Byte getEventsDefault()
-
setEventsDefault
public void setEventsDefault(Byte eventsDefault)
-
getInvite
public Byte getInvite()
-
setInvite
public void setInvite(Byte invite)
-
getKick
public Byte getKick()
-
setKick
public void setKick(Byte kick)
-
getRedact
public Byte getRedact()
-
setRedact
public void setRedact(Byte redact)
-
getStateDefault
public Byte getStateDefault()
-
setStateDefault
public void setStateDefault(Byte stateDefault)
-
getUsersDefault
public Byte getUsersDefault()
-
setUsersDefault
public void setUsersDefault(Byte usersDefault)
-
getNotifications
public NotificationPowerLevel getNotifications()
-
setNotifications
public void setNotifications(NotificationPowerLevel notifications)
-
-