-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor power level event management; Room::powerLevelFor()
This commit makes RoomPowerLevelsEvent _always_ available via currentState() - no need to query()/queryOr(), just get() and safely access all the members. This is possible because the spec defines default power levels for all kinds of cases; we can just inject a synthetic RoomPowerLevelsEvent object with those defaults into currentState() and once the real event comes (either from the homeserver or from the cache) it replaces the synthetic one by normal means of state processing. Thanks to that, Room::memberEffectivePowerLevel() implementation becomes much simpler; and to match it on the other side of power level checks, Room::powerLevelFor() is introduced as a unified call returning the power level necessary to send any specific event type, state or not.
- Loading branch information
1 parent
f220233
commit c57e97a
Showing
3 changed files
with
72 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters