mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Add event type and content struct for moderation policy lists
This commit is contained in:
parent
2bb1d1ca17
commit
f7a6fd2a8b
3 changed files with 15 additions and 1 deletions
|
|
@ -30,6 +30,9 @@ var TypeMap = map[Type]reflect.Type{
|
|||
StateHistoryVisibility: reflect.TypeOf(HistoryVisibilityEventContent{}),
|
||||
StateGuestAccess: reflect.TypeOf(GuestAccessEventContent{}),
|
||||
StatePinnedEvents: reflect.TypeOf(PinnedEventsEventContent{}),
|
||||
StatePolicyRoom: reflect.TypeOf(ModPolicyContent{}),
|
||||
StatePolicyServer: reflect.TypeOf(ModPolicyContent{}),
|
||||
StatePolicyUser: reflect.TypeOf(ModPolicyContent{}),
|
||||
StateEncryption: reflect.TypeOf(EncryptionEventContent{}),
|
||||
StateBridge: reflect.TypeOf(BridgeEventContent{}),
|
||||
StateHalfShotBridge: reflect.TypeOf(BridgeEventContent{}),
|
||||
|
|
|
|||
|
|
@ -144,3 +144,11 @@ type SpaceParentEventContent struct {
|
|||
Via []string `json:"via,omitempty"`
|
||||
Canonical bool `json:"canonical,omitempty"`
|
||||
}
|
||||
|
||||
// ModPolicyContent represents the content of a m.room.rule.user, m.room.rule.room, and m.room.rule.server state event.
|
||||
// https://spec.matrix.org/v1.1/client-server-api/#moderation-policy-lists
|
||||
type ModPolicyContent struct {
|
||||
Entity string `json:"entity"`
|
||||
Reason string `json:"reason"`
|
||||
Recommendation string `json:"recommendation"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ func (et *Type) GuessClass() TypeClass {
|
|||
case StateAliases.Type, StateCanonicalAlias.Type, StateCreate.Type, StateJoinRules.Type, StateMember.Type,
|
||||
StatePowerLevels.Type, StateRoomName.Type, StateRoomAvatar.Type, StateServerACL.Type, StateTopic.Type,
|
||||
StatePinnedEvents.Type, StateTombstone.Type, StateEncryption.Type, StateBridge.Type, StateHalfShotBridge.Type,
|
||||
StateSpaceParent.Type, StateSpaceChild.Type:
|
||||
StateSpaceParent.Type, StateSpaceChild.Type, StatePolicyRoom.Type, StatePolicyServer.Type, StatePolicyUser.Type:
|
||||
return StateEventType
|
||||
case EphemeralEventReceipt.Type, EphemeralEventTyping.Type, EphemeralEventPresence.Type:
|
||||
return EphemeralEventType
|
||||
|
|
@ -177,6 +177,9 @@ var (
|
|||
StatePinnedEvents = Type{"m.room.pinned_events", StateEventType}
|
||||
StateServerACL = Type{"m.room.server_acl", StateEventType}
|
||||
StateTombstone = Type{"m.room.tombstone", StateEventType}
|
||||
StatePolicyRoom = Type{"m.policy.rule.room", StateEventType}
|
||||
StatePolicyServer = Type{"m.policy.rule.server", StateEventType}
|
||||
StatePolicyUser = Type{"m.policy.rule.user", StateEventType}
|
||||
StateEncryption = Type{"m.room.encryption", StateEventType}
|
||||
StateBridge = Type{"m.bridge", StateEventType}
|
||||
StateHalfShotBridge = Type{"uk.half-shot.bridge", StateEventType}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue