Skip to content

Commit

Permalink
Add MSC2716's historical field to power level content
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 30, 2021
1 parent bd6990e commit 89d0d57
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions event/powerlevels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 89d0d57

Please sign in to comment.