about summary refs log tree commit diff
path: root/LibMatrix/StateEventTypes
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-15 09:50:45 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-09-15 09:50:45 +0200
commit6bd02248ccfbcb46960a6f39eaad23888d190eb5 (patch)
tree110578f31b6f9f70a7a1edab32fb3a34d6ad4f1a /LibMatrix/StateEventTypes
parentMedia moderator PoC works, abstract command handling to library (diff)
downloadLibMatrix-6bd02248ccfbcb46960a6f39eaad23888d190eb5.tar.xz
Some refactoring
Diffstat (limited to 'LibMatrix/StateEventTypes')
-rw-r--r--LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/CanonicalAliasEventContent.cs (renamed from LibMatrix/StateEventTypes/Spec/CanonicalAliasEventData.cs)2
-rw-r--r--LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs24
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs2
-rw-r--r--LibMatrix/StateEventTypes/UnknownStateEventData.cs7
24 files changed, 31 insertions, 44 deletions
diff --git a/LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs b/LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs

index 7a4b3f3..ff11be7 100644 --- a/LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs +++ b/LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Common; [MatrixEvent(EventName = "org.matrix.mjolnir.shortcode")] -public class MjolnirShortcodeEventData : IStateEventType { +public class MjolnirShortcodeEventContent : EventContent { [JsonPropertyName("shortcode")] public string? Shortcode { get; set; } } diff --git a/LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs b/LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs
index ad65b0f..a056eda 100644 --- a/LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs +++ b/LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Common; [MatrixEvent(EventName = "im.ponies.room_emotes")] -public class RoomEmotesEventData : IStateEventType { +public class RoomEmotesEventContent : EventContent { [JsonPropertyName("emoticons")] public Dictionary<string, EmoticonData>? Emoticons { get; set; } diff --git a/LibMatrix/StateEventTypes/Spec/CanonicalAliasEventData.cs b/LibMatrix/StateEventTypes/Spec/CanonicalAliasEventContent.cs
index 269bd6d..7a0e84c 100644 --- a/LibMatrix/StateEventTypes/Spec/CanonicalAliasEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/CanonicalAliasEventContent.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.canonical_alias")] -public class CanonicalAliasEventData : IStateEventType { +public class CanonicalAliasEventContent : EventContent { [JsonPropertyName("alias")] public string? Alias { get; set; } [JsonPropertyName("alt_aliases")] diff --git a/LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs b/LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs
index 7ba3428..0709b86 100644 --- a/LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.guest_access")] -public class GuestAccessEventData : IStateEventType { +public class GuestAccessEventContent : EventContent { [JsonPropertyName("guest_access")] public string GuestAccess { get; set; } diff --git a/LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs b/LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs
index deca7c8..b19dd32 100644 --- a/LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.history_visibility")] -public class HistoryVisibilityEventData : IStateEventType { +public class HistoryVisibilityEventContent : EventContent { [JsonPropertyName("history_visibility")] public string HistoryVisibility { get; set; } } diff --git a/LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs b/LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs
index b64c1dd..8c0772f 100644 --- a/LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.join_rules")] -public class JoinRulesEventData : IStateEventType { +public class JoinRulesEventContent : EventContent { private static string Public = "public"; private static string Invite = "invite"; private static string Knock = "knock"; diff --git a/LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs b/LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs
index 2e66bd9..539e371 100644 --- a/LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs
@@ -7,7 +7,7 @@ namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.policy.rule.user")] [MatrixEvent(EventName = "m.policy.rule.server")] [MatrixEvent(EventName = "org.matrix.mjolnir.rule.server")] -public class PolicyRuleStateEventData : IStateEventType { +public class PolicyRuleEventContent : EventContent { /// <summary> /// Entity this ban applies to, can use * and ? as globs. /// </summary> diff --git a/LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs b/LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs
index 5167502..b897ff0 100644 --- a/LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.presence")] -public class PresenceStateEventData : IStateEventType { +public class PresenceEventContent : EventContent { [JsonPropertyName("presence")] public string Presence { get; set; } [JsonPropertyName("last_active_ago")] diff --git a/LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs b/LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs
index 14449e0..9b4f1d0 100644 --- a/LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs
@@ -3,7 +3,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; -public class ProfileResponseEventData : IStateEventType { +public class ProfileResponseEventContent : EventContent { [JsonPropertyName("avatar_url")] public string? AvatarUrl { get; set; } diff --git a/LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs
index 3f2c39e..d3960a1 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.alias")] -public class RoomAliasEventData : IStateEventType { +public class RoomAliasEventContent : EventContent { [JsonPropertyName("aliases")] public List<string>? Aliases { get; set; } } diff --git a/LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs
index f71e1fb..e2263c8 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.avatar")] -public class RoomAvatarEventData : IStateEventType { +public class RoomAvatarEventContent : EventContent { [JsonPropertyName("url")] public string? Url { get; set; } diff --git a/LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs
index 31f9411..22df784 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.create")] -public class RoomCreateEventData : IStateEventType { +public class RoomCreateEventContent : EventContent { [JsonPropertyName("room_version")] public string? RoomVersion { get; set; } [JsonPropertyName("creator")] diff --git a/LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs
index 9673dcc..1d5ec2c 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.encryption")] -public class RoomEncryptionEventData : IStateEventType { +public class RoomEncryptionEventContent : EventContent { [JsonPropertyName("algorithm")] public string? Algorithm { get; set; } [JsonPropertyName("rotation_period_ms")] diff --git a/LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs
index c99aa8d..a9d4710 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.member")] -public class RoomMemberEventData : IStateEventType { +public class RoomMemberEventContent : EventContent { [JsonPropertyName("reason")] public string? Reason { get; set; } diff --git a/LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs
index d13c273..a15efe8 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs
@@ -6,19 +6,12 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.message")] -public class RoomMessageEventData : IStateEventType { - public RoomMessageEventData() { } - - public RoomMessageEventData(string messageType, string body) { +public class RoomMessageEventContent : EventContent { + public RoomMessageEventContent(string? messageType = "m.notice", string? body = null) { MessageType = messageType; Body = body; } - public RoomMessageEventData(string body) : this() { - Body = body; - MessageType = "m.notice"; - } - [JsonPropertyName("body")] public string Body { get; set; } @@ -31,22 +24,9 @@ public class RoomMessageEventData : IStateEventType { [JsonPropertyName("format")] public string Format { get; set; } - [JsonPropertyName("m.relates_to")] - public MessageRelatesTo? RelatesTo { get; set; } - /// <summary> /// Media URI for this message, if any /// </summary> [JsonPropertyName("url")] public string? Url { get; set; } - - public class MessageRelatesTo { - [JsonPropertyName("m.in_reply_to")] - public MessageInReplyTo? InReplyTo { get; set; } - - public class MessageInReplyTo { - [JsonPropertyName("event_id")] - public string EventId { get; set; } - } - } } diff --git a/LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs
index e04f0dc..3002102 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.name")] -public class RoomNameEventData : IStateEventType { +public class RoomNameEventContent : EventContent { [JsonPropertyName("name")] public string? Name { get; set; } } diff --git a/LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs
index bb78aeb..16144bc 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.pinned_events")] -public class RoomPinnedEventData : IStateEventType { +public class RoomPinnedEventContent : EventContent { [JsonPropertyName("pinned")] public string[]? PinnedEvents { get; set; } } diff --git a/LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs
index b4f7d53..960c198 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.power_levels")] -public class RoomPowerLevelEventData : IStateEventType { +public class RoomPowerLevelEventContent : EventContent { [JsonPropertyName("ban")] public long Ban { get; set; } // = 50; diff --git a/LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs
index c3deb98..61d1a01 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs
@@ -6,7 +6,7 @@ namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.topic")] [MatrixEvent(EventName = "org.matrix.msc3765.topic", Legacy = true)] -public class RoomTopicEventData : IStateEventType { +public class RoomTopicEventContent : EventContent { [JsonPropertyName("topic")] public string? Topic { get; set; } } diff --git a/LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs b/LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs
index 3812c46..e935cb2 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.typing")] -public class RoomTypingEventData : IStateEventType { +public class RoomTypingEventContent : EventContent { [JsonPropertyName("user_ids")] public string[]? UserIds { get; set; } } diff --git a/LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs b/LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs
index d00b464..031d113 100644 --- a/LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.room.server_acl")] -public class ServerACLEventData : IStateEventType { +public class ServerACLEventContent : EventContent { [JsonPropertyName("allow")] public List<string> Allow { get; set; } // = null!; diff --git a/LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs b/LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs
index e8c6d18..80fc771 100644 --- a/LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.space.child")] -public class SpaceChildEventData : IStateEventType { +public class SpaceChildEventContent : EventContent { [JsonPropertyName("auto_join")] public bool? AutoJoin { get; set; } [JsonPropertyName("via")] diff --git a/LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs b/LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs
index ebd083e..1bc89ab 100644 --- a/LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs +++ b/LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs
@@ -5,7 +5,7 @@ using LibMatrix.Interfaces; namespace LibMatrix.StateEventTypes.Spec; [MatrixEvent(EventName = "m.space.parent")] -public class SpaceParentEventData : IStateEventType { +public class SpaceParentEventContent : EventContent { [JsonPropertyName("via")] public string[]? Via { get; set; } diff --git a/LibMatrix/StateEventTypes/UnknownStateEventData.cs b/LibMatrix/StateEventTypes/UnknownStateEventData.cs new file mode 100644
index 0000000..59d8fd4 --- /dev/null +++ b/LibMatrix/StateEventTypes/UnknownStateEventData.cs
@@ -0,0 +1,7 @@ +using LibMatrix.Interfaces; + +namespace LibMatrix.StateEventTypes; + +public class UnknownEventContent : EventContent { + +}