From 89d0d57059aad6c009f55b7bebe234b7300494ce Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 30 Dec 2021 12:29:05 +0200 Subject: [PATCH] Add MSC2716's historical field to power level content --- event/powerlevels.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/event/powerlevels.go b/event/powerlevels.go index 266591d0..3c4576c4 100644 --- a/event/powerlevels.go +++ b/event/powerlevels.go @@ -25,10 +25,11 @@ type PowerLevelsEventContent struct { StateDefaultPtr *int `json:"state_default,omitempty"` - InvitePtr *int `json:"invite,omitempty"` - KickPtr *int `json:"kick,omitempty"` - BanPtr *int `json:"ban,omitempty"` - RedactPtr *int `json:"redact,omitempty"` + InvitePtr *int `json:"invite,omitempty"` + KickPtr *int `json:"kick,omitempty"` + BanPtr *int `json:"ban,omitempty"` + RedactPtr *int `json:"redact,omitempty"` + HistoricalPtr *int `json:"historical,omitempty"` } func (pl *PowerLevelsEventContent) Invite() int { @@ -59,6 +60,13 @@ func (pl *PowerLevelsEventContent) Redact() int { return 50 } +func (pl *PowerLevelsEventContent) Historical() int { + if pl.HistoricalPtr != nil { + return *pl.HistoricalPtr + } + return 100 +} + func (pl *PowerLevelsEventContent) StateDefault() int { if pl.StateDefaultPtr != nil { return *pl.StateDefaultPtr