Skip to content

Commit

Permalink
event: add unstable prefixes for policy events
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Aug 30, 2024
1 parent 87ca6a9 commit 7939151
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions event/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ var TypeMap = map[Type]reflect.Type{
StateSpaceChild: reflect.TypeOf(SpaceChildEventContent{}),
StateInsertionMarker: reflect.TypeOf(InsertionMarkerContent{}),

StateLegacyPolicyRoom: reflect.TypeOf(ModPolicyContent{}),
StateLegacyPolicyServer: reflect.TypeOf(ModPolicyContent{}),
StateLegacyPolicyUser: reflect.TypeOf(ModPolicyContent{}),
StateUnstablePolicyRoom: reflect.TypeOf(ModPolicyContent{}),
StateUnstablePolicyServer: reflect.TypeOf(ModPolicyContent{}),
StateUnstablePolicyUser: reflect.TypeOf(ModPolicyContent{}),

StateElementFunctionalMembers: reflect.TypeOf(ElementFunctionalMembersContent{}),

EventMessage: reflect.TypeOf(MessageEventContent{}),
Expand Down
3 changes: 2 additions & 1 deletion event/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ type SpaceParentEventContent struct {
type PolicyRecommendation string

const (
PolicyRecommendationBan PolicyRecommendation = "m.ban"
PolicyRecommendationBan PolicyRecommendation = "m.ban"
PolicyRecommendationUnstableBan PolicyRecommendation = "org.matrix.mjolnir.ban"
)

// ModPolicyContent represents the content of a m.room.rule.user, m.room.rule.room, and m.room.rule.server state event.
Expand Down
7 changes: 7 additions & 0 deletions event/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ var (
StateSpaceChild = Type{"m.space.child", StateEventType}
StateSpaceParent = Type{"m.space.parent", StateEventType}

StateLegacyPolicyRoom = Type{"m.room.rule.room", StateEventType}
StateLegacyPolicyServer = Type{"m.room.rule.server", StateEventType}
StateLegacyPolicyUser = Type{"m.room.rule.user", StateEventType}
StateUnstablePolicyRoom = Type{"org.matrix.mjolnir.rule.room", StateEventType}
StateUnstablePolicyServer = Type{"org.matrix.mjolnir.rule.server", StateEventType}
StateUnstablePolicyUser = Type{"org.matrix.mjolnir.rule.user", StateEventType}

// Deprecated: MSC2716 has been abandoned
StateInsertionMarker = Type{"org.matrix.msc2716.marker", StateEventType}

Expand Down

0 comments on commit 7939151

Please sign in to comment.