19 QHash<QString,
int> events{};
20 int eventsDefault = 0;
21 int stateDefault = 50;
23 QHash<QString,
int> users{};
26 struct Notifications {
29 Notifications notifications{};
33 struct QUOTIENT_API JsonConverter<PowerLevelsEventContent> {
34 static PowerLevelsEventContent load(
const QJsonValue& jv);
35 static QJsonObject dump(
const PowerLevelsEventContent& c);
39 :
public KeylessStateEventBase<RoomPowerLevelsEvent, PowerLevelsEventContent> {
41 QUO_EVENT(RoomPowerLevelsEvent,
"m.room.power_levels")
43 using KeylessStateEventBase::KeylessStateEventBase;
45 int invite()
const {
return content().invite; }
46 int kick()
const {
return content().kick; }
47 int ban()
const {
return content().ban; }
49 int redact()
const {
return content().redact; }
51 QHash<QString,
int> events()
const {
return content().events; }
52 int eventsDefault()
const {
return content().eventsDefault; }
53 int stateDefault()
const {
return content().stateDefault; }
55 QHash<QString,
int> users()
const {
return content().users; }
56 int usersDefault()
const {
return content().usersDefault; }
58 int roomNotification()
const {
return content().notifications.room; }
65 int powerLevelForEvent(
const QString& eventTypeId)
const;
72 int powerLevelForState(
const QString& eventTypeId)
const;
80 int powerLevelForUser(
const QString& userId)
const;
82 template <EventClass EvT>
83 int powerLevelForEventType()
const
85 if constexpr (std::is_base_of_v<StateEvent, EvT>) {
86 return powerLevelForState(EvT::TypeId);
88 return powerLevelForEvent(EvT::TypeId);