aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlack Hat <bhat@encom.eu.org>2020-01-01 14:45:42 +0800
committerBlack Hat <bhat@encom.eu.org>2020-01-01 14:45:42 +0800
commitd4034fb12b189156e135dcf0fb94960a1d8e9be9 (patch)
treeb0e3fd5833b0a8f91c552e846b18d0865f4aae8e
parent2a54e66226863bdea4b0828675f38b75e4c7776f (diff)
downloadlibquotient-d4034fb12b189156e135dcf0fb94960a1d8e9be9.tar.gz
libquotient-d4034fb12b189156e135dcf0fb94960a1d8e9be9.zip
Add powerLevelForState()
-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: