diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-13 20:25:05 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-13 20:25:05 +0200 |
commit | 712ad189c99570f686ab779782b2a873e172428e (patch) | |
tree | 6102e4719416e71522e9143fa4e06951258bd77c /MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs | |
parent | Fix passwords being visible during editing (diff) | |
download | MatrixUtils-712ad189c99570f686ab779782b2a873e172428e.tar.xz |
Change syntax style
Diffstat (limited to 'MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs')
-rw-r--r-- | MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs | 175 |
1 files changed, 77 insertions, 98 deletions
diff --git a/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs b/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs index c43bd3c..77c8281 100644 --- a/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs +++ b/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs @@ -1,110 +1,89 @@ +using System.Text.Json.Nodes; using MatrixRoomUtils.Core; using MatrixRoomUtils.Core.Responses; namespace MatrixRoomUtils.Web.Classes.RoomCreationTemplates; -public class DefaultRoomCreationTemplate : IRoomCreationTemplate -{ +public class DefaultRoomCreationTemplate : IRoomCreationTemplate { public string Name => "Default"; - public CreateRoomRequest CreateRoomRequest - { - get - { - return new() - { - Name = "My new room", - RoomAliasName = "myroom", - InitialState = new() - { - new() - { - Type = "m.room.history_visibility", - Content = new - { - history_visibility = "world_readable" - } - }, - new StateEvent<Pages.RoomManager.RoomManagerCreateRoom.GuestAccessContent> - { - Type = "m.room.guest_access", - Content = new() - { - GuestAccess = "can_join" - } - }, - new() - { - Type = "m.room.join_rules", - Content = new - { - join_rule = "public" - } - }, - new() - { - Type = "m.room.server_acl", - Content = new - { - allow = new[] { "*" }, - deny = Array.Empty<string>(), - allow_ip_literals = false - } - }, - new() - { - Type = "m.room.avatar", - Content = new - { - url = "mxc://feline.support/UKNhEyrVsrAbYteVvZloZcFj" - } + + public CreateRoomRequest CreateRoomRequest => + new CreateRoomRequest { + Name = "My new room", + RoomAliasName = "myroom", + InitialState = new List<StateEvent> { + new() { + Type = "m.room.history_visibility", + Content = new { + history_visibility = "world_readable" } }, - Visibility = "public", - PowerLevelContentOverride = new() - { - UsersDefault = 0, - EventsDefault = 100, - StateDefault = 50, - Invite = 0, - Redact = 50, - Kick = 50, - Ban = 50, - NotificationsPl = new() - { - Room = 50 - }, - Events = new() - { - { "im.vector.modular.widgets", 50 }, - { "io.element.voice_broadcast_info", 50 }, - { "m.reaction", 100 }, - { "m.room.avatar", 50 }, - { "m.room.canonical_alias", 50 }, - { "m.room.encryption", 100 }, - { "m.room.history_visibility", 100 }, - { "m.room.name", 50 }, - { "m.room.pinned_events", 50 }, - { "m.room.power_levels", 100 }, - { "m.room.redaction", 100 }, - { "m.room.server_acl", 100 }, - { "m.room.tombstone", 100 }, - { "m.room.topic", 50 }, - { "m.space.child", 50 }, - { "org.matrix.msc3401.call", 50 }, - { "org.matrix.msc3401.call.member", 50 } - }, - Users = new() - { - { RuntimeCache.CurrentHomeServer.UserId, 100 }, - }, + new StateEvent<Pages.RoomManager.RoomManagerCreateRoom.GuestAccessContent> { + Type = "m.room.guest_access", + Content = new Pages.RoomManager.RoomManagerCreateRoom.GuestAccessContent { + GuestAccess = "can_join" + } }, - CreationContent = new() - { - { - "type", null + new() { + Type = "m.room.join_rules", + Content = new { + join_rule = "public" + } + }, + new() { + Type = "m.room.server_acl", + Content = new { + allow = new[] { "*" }, + deny = Array.Empty<string>(), + allow_ip_literals = false } + }, + new() { + Type = "m.room.avatar", + Content = new { + url = "mxc://feline.support/UKNhEyrVsrAbYteVvZloZcFj" + } + } + }, + Visibility = "public", + PowerLevelContentOverride = new PowerLevelEvent { + UsersDefault = 0, + EventsDefault = 100, + StateDefault = 50, + Invite = 0, + Redact = 50, + Kick = 50, + Ban = 50, + NotificationsPl = new NotificationsPL { + Room = 50 + }, + Events = new Dictionary<string, int> { + { "im.vector.modular.widgets", 50 }, + { "io.element.voice_broadcast_info", 50 }, + { "m.reaction", 100 }, + { "m.room.avatar", 50 }, + { "m.room.canonical_alias", 50 }, + { "m.room.encryption", 100 }, + { "m.room.history_visibility", 100 }, + { "m.room.name", 50 }, + { "m.room.pinned_events", 50 }, + { "m.room.power_levels", 100 }, + { "m.room.redaction", 100 }, + { "m.room.server_acl", 100 }, + { "m.room.tombstone", 100 }, + { "m.room.topic", 50 }, + { "m.space.child", 50 }, + { "org.matrix.msc3401.call", 50 }, + { "org.matrix.msc3401.call.member", 50 } + }, + Users = new Dictionary<string, int> { + { RuntimeCache.CurrentHomeServer.UserId, 100 } + } + }, + CreationContent = new JsonObject { + { + "type", null } - }; - } - } + } + }; } \ No newline at end of file |