aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/events/roompowerlevelsevent.cpp10
-rw-r--r--lib/events/roompowerlevelsevent.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/events/roompowerlevelsevent.cpp b/lib/events/roompowerlevelsevent.cpp
index aff64cff..98588142 100644
--- a/lib/events/roompowerlevelsevent.cpp
+++ b/lib/events/roompowerlevelsevent.cpp
@@ -41,6 +41,16 @@ int RoomPowerLevelsEvent::powerLevelForEvent(const QString &eventId) const {
return eventsDefault();
}
+int RoomPowerLevelsEvent::powerLevelForState(const QString &eventId) const {
+ auto e = events();
+
+ if (e.contains(eventId)) {
+ return e[eventId];
+ }
+
+ return stateDefault();
+}
+
int RoomPowerLevelsEvent::powerLevelForUser(const QString &userId) const {
auto u = users();
diff --git a/lib/events/roompowerlevelsevent.h b/lib/events/roompowerlevelsevent.h
index b3405c56..f0f7207f 100644
--- a/lib/events/roompowerlevelsevent.h
+++ b/lib/events/roompowerlevelsevent.h
@@ -56,6 +56,7 @@ public:
int roomNotification() const { return content().notifications.room; }
int powerLevelForEvent(const QString& eventId) const;
+ int powerLevelForState(const QString& eventId) const;
int powerLevelForUser(const QString& userId) const;
private: