From bd11271621bd3759cfd194ed0119c0dc28155fd0 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 5 Mar 2026 14:57:28 +0100 Subject: update --- .../Events/Room/PowerLevelsEvent.php | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 matrix-specification/Events/Room/PowerLevelsEvent.php (limited to 'matrix-specification/Events/Room/PowerLevelsEvent.php') diff --git a/matrix-specification/Events/Room/PowerLevelsEvent.php b/matrix-specification/Events/Room/PowerLevelsEvent.php new file mode 100644 index 0000000..8b609f3 --- /dev/null +++ b/matrix-specification/Events/Room/PowerLevelsEvent.php @@ -0,0 +1,57 @@ + $events This is a mapping from event type to power level required. + * @param ?array $notifications This is a mapping from key to power level for that notifications key. + * @param ?array $events This is a mapping from user_id to power level for that user. + */ + public function __construct( + string $eventId, + int $originServerTimestamp, + string $roomId, + string $sender, + ?int $ban = 50, + ?array $events = null, + ?int $eventsDefault = 0, + ?int $invite = 0, + ?int $kick = 50, + ?array $notifications = null, # TODO: https://spec.matrix.org/v1.17/client-server-api/#mroompower_levels_notifications + ?int $redact = 50, + ?int $stateDefault = 50, + ?array $users = null, + ?int $usersDefault = 0, + string $stateKey = "", + ?UnsignedData $unsigned = null, + ) + { + parent::__construct( + array_filter([ + "ban" => $ban, + "events" => $events, + "events_default" => $eventsDefault, + "invite" => $invite, + "kick" => $kick, + "notifications" => $notifications, + "redact" => $redact, + "state_default" => $stateDefault, + "users" => $users, + "users_default" => $usersDefault, + ], fn ($value) => ! is_null($value)), + $eventId, + $originServerTimestamp, + $roomId, + $sender, + $stateKey, + EventType::ROOM_POWER_LEVELS, + $unsigned, + ); + } +} -- cgit v1.2.3