about summary refs log tree commit diff
path: root/LibMatrix/EventTypes/Spec/State
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/EventTypes/Spec/State')
-rw-r--r--LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs75
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs12
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs29
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs15
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs32
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs14
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs15
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs10
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs29
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs30
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs12
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs10
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs79
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs16
-rw-r--r--LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs11
-rw-r--r--LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs14
-rw-r--r--LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs13
17 files changed, 0 insertions, 416 deletions
diff --git a/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs b/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
deleted file mode 100644
index 80d87d6..0000000
--- a/LibMatrix/EventTypes/Spec/State/Policy/PolicyRuleStateEventContent.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-//spec
-[MatrixEvent(EventName = EventId)] //spec
-[MatrixEvent(EventName = "m.room.rule.server")] //???
-[MatrixEvent(EventName = "org.matrix.mjolnir.rule.server")] //legacy
-public class ServerPolicyRuleEventContent : PolicyRuleEventContent {
-    public const string EventId = "m.policy.rule.server";
-}
-
-[MatrixEvent(EventName = EventId)] //spec
-[MatrixEvent(EventName = "m.room.rule.user")] //???
-[MatrixEvent(EventName = "org.matrix.mjolnir.rule.user")] //legacy
-public class UserPolicyRuleEventContent : PolicyRuleEventContent {
-    public const string EventId = "m.policy.rule.user";
-}
-
-[MatrixEvent(EventName = EventId)] //spec
-[MatrixEvent(EventName = "m.room.rule.room")] //???
-[MatrixEvent(EventName = "org.matrix.mjolnir.rule.room")] //legacy
-public class RoomPolicyRuleEventContent : PolicyRuleEventContent {
-    public const string EventId = "m.policy.rule.room";
-}
-
-public abstract class PolicyRuleEventContent : EventContent {
-    /// <summary>
-    ///     Entity this ban applies to, can use * and ? as globs.
-    ///     Policy is invalid if entity is null
-    /// </summary>
-    [JsonPropertyName("entity")]
-    public string? Entity { get; set; }
-
-    /// <summary>
-    ///     Reason this user is banned
-    /// </summary>
-    [JsonPropertyName("reason")]
-    public string? Reason { get; set; }
-
-    /// <summary>
-    ///     Suggested action to take
-    /// </summary>
-    [JsonPropertyName("recommendation")]
-    public string? Recommendation { get; set; }
-
-    /// <summary>
-    ///     Expiry time in milliseconds since the unix epoch, or null if the ban has no expiry.
-    /// </summary>
-    [JsonPropertyName("support.feline.policy.expiry.rev.2")] //stable prefix: expiry, msc pending
-    public long? Expiry { get; set; }
-
-    //utils
-    /// <summary>
-    ///     Readable expiry time, provided for easy interaction
-    /// </summary>
-    [JsonPropertyName("gay.rory.matrix_room_utils.readable_expiry_time_utc")]
-    public DateTime? ExpiryDateTime {
-        get => Expiry == null ? null : DateTimeOffset.FromUnixTimeMilliseconds(Expiry.Value).DateTime;
-        set => Expiry = ((DateTimeOffset)value).ToUnixTimeMilliseconds();
-    }
-}
-
-public static class PolicyRecommendationTypes {
-    /// <summary>
-    ///     Ban this user
-    /// </summary>
-    public static string Ban = "m.ban";
-
-    /// <summary>
-    ///     Mute this user
-    /// </summary>
-    public static string Mute = "support.feline.policy.recommendation_mute"; //stable prefix: m.mute, msc pending
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
deleted file mode 100644
index 830386d..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAliasEventContent.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomAliasEventContent : TimelineEventContent {
-    public const string EventId = "m.room.alias";
-
-    [JsonPropertyName("aliases")]
-    public List<string>? Aliases { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
deleted file mode 100644
index 9c208ba..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomAvatarEventContent.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomAvatarEventContent : TimelineEventContent {
-    public const string EventId = "m.room.avatar";
-
-    [JsonPropertyName("url")]
-    public string? Url { get; set; }
-
-    [JsonPropertyName("info")]
-    public RoomAvatarInfo? Info { get; set; }
-
-    public class RoomAvatarInfo {
-        [JsonPropertyName("h")]
-        public int? Height { get; set; }
-
-        [JsonPropertyName("w")]
-        public int? Width { get; set; }
-
-        [JsonPropertyName("mimetype")]
-        public string? MimeType { get; set; }
-
-        [JsonPropertyName("size")]
-        public int? Size { get; set; }
-    }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
deleted file mode 100644
index 5ba253c..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCanonicalAliasEventContent.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomCanonicalAliasEventContent : TimelineEventContent {
-    public const string EventId = "m.room.canonical_alias";
-
-    [JsonPropertyName("alias")]
-    public string? Alias { get; set; }
-
-    [JsonPropertyName("alt_aliases")]
-    public string[]? AltAliases { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
deleted file mode 100644
index 41145de..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomCreateEventContent.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomCreateEventContent : TimelineEventContent {
-    public const string EventId = "m.room.create";
-
-    [JsonPropertyName("room_version")]
-    public string? RoomVersion { get; set; }
-
-    [JsonPropertyName("creator")]
-    public string? Creator { get; set; }
-
-    [JsonPropertyName("m.federate")]
-    public bool? Federate { get; set; }
-
-    [JsonPropertyName("predecessor")]
-    public RoomCreatePredecessor? Predecessor { get; set; }
-
-    [JsonPropertyName("type")]
-    public string? Type { get; set; }
-
-    public class RoomCreatePredecessor {
-        [JsonPropertyName("room_id")]
-        public string? RoomId { get; set; }
-
-        [JsonPropertyName("event_id")]
-        public string? EventId { get; set; }
-    }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
deleted file mode 100644
index a3627f2..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomEncryptionEventContent.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.encryption")]
-public class RoomEncryptionEventContent : TimelineEventContent {
-    [JsonPropertyName("algorithm")]
-    public string? Algorithm { get; set; }
-    [JsonPropertyName("rotation_period_ms")]
-    public ulong? RotationPeriodMs { get; set; }
-    [JsonPropertyName("rotation_period_msgs")]
-    public ulong? RotationPeriodMsgs { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
deleted file mode 100644
index 5bad649..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomGuestAccessEventContent.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.guest_access")]
-public class RoomGuestAccessEventContent : TimelineEventContent {
-    [JsonPropertyName("guest_access")]
-    public string GuestAccess { get; set; }
-
-    public bool IsGuestAccessEnabled {
-        get => GuestAccess == "can_join";
-        set => GuestAccess = value ? "can_join" : "forbidden";
-    }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
deleted file mode 100644
index 8f5c7f1..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomHistoryVisibilityEventContent.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.history_visibility")]
-public class RoomHistoryVisibilityEventContent : TimelineEventContent {
-    [JsonPropertyName("history_visibility")]
-    public string HistoryVisibility { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
deleted file mode 100644
index 2db9e60..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomJoinRulesEventContent.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.join_rules")]
-public class RoomJoinRulesEventContent : TimelineEventContent {
-    private static string Public = "public";
-    private static string Invite = "invite";
-    private static string Knock = "knock";
-
-    /// <summary>
-    /// one of ["public", "invite", "knock", "restricted", "knock_restricted"]
-    /// "private" is reserved without implementation!
-    /// </summary>
-    [JsonPropertyName("join_rule")]
-    public string JoinRule { get; set; }
-
-    [JsonPropertyName("allow")]
-    public List<AllowEntry> Allow { get; set; }
-
-    public class AllowEntry {
-        [JsonPropertyName("type")]
-        public string Type { get; set; }
-
-        [JsonPropertyName("room_id")]
-        public string RoomId { get; set; }
-    }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
deleted file mode 100644
index 698315e..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomMemberEventContent.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomMemberEventContent : TimelineEventContent {
-    public const string EventId = "m.room.member";
-
-    [JsonPropertyName("reason")]
-    public string? Reason { get; set; }
-
-    [JsonPropertyName("membership")]
-    public string Membership { get; set; } = null!;
-
-    [JsonPropertyName("displayname")]
-    public string? DisplayName { get; set; }
-
-    [JsonPropertyName("is_direct")]
-    public bool? IsDirect { get; set; }
-
-    [JsonPropertyName("avatar_url")]
-    public string? AvatarUrl { get; set; }
-
-    [JsonPropertyName("kind")]
-    public string? Kind { get; set; }
-
-    [JsonPropertyName("join_authorised_via_users_server")]
-    public string? JoinAuthorisedViaUsersServer { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
deleted file mode 100644
index 9ad67eb..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomNameEventContent.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomNameEventContent : TimelineEventContent {
-    public const string EventId = "m.room.name";
-
-    [JsonPropertyName("name")]
-    public string? Name { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
deleted file mode 100644
index 11fe208..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPinnedEventContent.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.pinned_events")]
-public class RoomPinnedEventContent : TimelineEventContent {
-    [JsonPropertyName("pinned")]
-    public string[]? PinnedEvents { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
deleted file mode 100644
index 08f8ad5..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomPowerLevelEventContent.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = EventId)]
-public class RoomPowerLevelEventContent : TimelineEventContent {
-    public const string EventId = "m.room.power_levels";
-
-    [JsonPropertyName("ban")]
-    public long? Ban { get; set; } = 50;
-
-    [JsonPropertyName("events_default")]
-    public long? EventsDefault { get; set; } = 0;
-
-    [JsonPropertyName("invite")]
-    public long? Invite { get; set; } = 0;
-
-    [JsonPropertyName("kick")]
-    public long? Kick { get; set; } = 50;
-
-    [JsonPropertyName("notifications")]
-    public NotificationsPL? NotificationsPl { get; set; } // = null!;
-
-    [JsonPropertyName("redact")]
-    public long? Redact { get; set; } = 50;
-
-    [JsonPropertyName("state_default")]
-    public long? StateDefault { get; set; } = 50;
-
-    [JsonPropertyName("events")]
-    public Dictionary<string, long>? Events { get; set; } // = null!;
-
-    [JsonPropertyName("users")]
-    public Dictionary<string, long>? Users { get; set; } // = null!;
-
-    [JsonPropertyName("users_default")]
-    public long? UsersDefault { get; set; } = 0;
-
-    [Obsolete("Historical was a key related to MSC2716, a spec change on backfill that was dropped!", true)]
-    [JsonIgnore]
-    [JsonPropertyName("historical")]
-    public long Historical { get; set; } // = 50;
-
-    public class NotificationsPL {
-        [JsonPropertyName("room")]
-        public long Room { get; set; } = 50;
-    }
-
-    public bool IsUserAdmin(string userId) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
-        return Users.TryGetValue(userId, out var level) && level >= Events.Max(x => x.Value);
-    }
-
-    public bool UserHasTimelinePermission(string userId, string eventType) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
-        return Users.TryGetValue(userId, out var level) && level >= Events.GetValueOrDefault(eventType, EventsDefault ?? 0);
-    }
-
-    public bool UserHasStatePermission(string userId, string eventType) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
-        return Users.TryGetValue(userId, out var level) && level >= Events.GetValueOrDefault(eventType, StateDefault ?? 50);
-    }
-
-    public long GetUserPowerLevel(string userId) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
-        return Users.TryGetValue(userId, out var level) ? level : UsersDefault ?? UsersDefault ?? 0;
-    }
-
-    public long GetEventPowerLevel(string eventType) {
-        return Events.TryGetValue(eventType, out var level) ? level : EventsDefault ?? EventsDefault ?? 0;
-    }
-
-    public void SetUserPowerLevel(string userId, long powerLevel) {
-        if (userId is null) throw new ArgumentNullException(nameof(userId));
-        Users ??= new();
-        Users[userId] = powerLevel;
-    }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
deleted file mode 100644
index cbd2241..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.server_acl")]
-public class RoomServerACLEventContent : TimelineEventContent {
-    [JsonPropertyName("allow")]
-    public List<string> Allow { get; set; } // = null!;
-
-    [JsonPropertyName("deny")]
-    public List<string> Deny { get; set; } // = null!;
-
-    [JsonPropertyName("allow_ip_literals")]
-    public bool AllowIpLiterals { get; set; } // = false;
-}
diff --git a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs b/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
deleted file mode 100644
index 866eecf..0000000
--- a/LibMatrix/EventTypes/Spec/State/RoomInfo/RoomTopicEventContent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.room.topic")]
-[MatrixEvent(EventName = "org.matrix.msc3765.topic", Legacy = true)]
-public class RoomTopicEventContent : TimelineEventContent {
-    [JsonPropertyName("topic")]
-    public string? Topic { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs b/LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs
deleted file mode 100644
index 82f4b7f..0000000
--- a/LibMatrix/EventTypes/Spec/State/Space/SpaceChildEventContent.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.space.child")]
-public class SpaceChildEventContent : TimelineEventContent {
-    [JsonPropertyName("auto_join")]
-    public bool? AutoJoin { get; set; }
-    [JsonPropertyName("via")]
-    public List<string>? Via { get; set; }
-    [JsonPropertyName("suggested")]
-    public bool? Suggested { get; set; }
-}
diff --git a/LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs b/LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs
deleted file mode 100644
index 887e91c..0000000
--- a/LibMatrix/EventTypes/Spec/State/Space/SpaceParentEventContent.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Text.Json.Serialization;
-using LibMatrix.Interfaces;
-
-namespace LibMatrix.EventTypes.Spec.State;
-
-[MatrixEvent(EventName = "m.space.parent")]
-public class SpaceParentEventContent : TimelineEventContent {
-    [JsonPropertyName("via")]
-    public string[]? Via { get; set; }
-
-    [JsonPropertyName("canonical")]
-    public bool? Canonical { get; set; }
-}