diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-11-09 07:38:33 +0100 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-11-09 07:38:33 +0100 |
commit | c37bcb0e4a878d4f4c0e47988adb8624131c82cd (patch) | |
tree | 706f5300ce83b511d807decddd5b3521168b5fc7 /MatrixRoomUtils.Web/Classes/RoomInfo.cs | |
parent | Fix updates (diff) | |
download | MatrixUtils-c37bcb0e4a878d4f4c0e47988adb8624131c82cd.tar.xz |
event types
Diffstat (limited to 'MatrixRoomUtils.Web/Classes/RoomInfo.cs')
-rw-r--r-- | MatrixRoomUtils.Web/Classes/RoomInfo.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/MatrixRoomUtils.Web/Classes/RoomInfo.cs b/MatrixRoomUtils.Web/Classes/RoomInfo.cs index a2fa6f5..37973a0 100644 --- a/MatrixRoomUtils.Web/Classes/RoomInfo.cs +++ b/MatrixRoomUtils.Web/Classes/RoomInfo.cs @@ -25,7 +25,18 @@ public class RoomInfo : NotifyPropertyChanged { @event.RawContent = await Room.GetStateAsync<JsonObject>(type, stateKey); } catch (MatrixException e) { - if (e is { ErrorCode: "M_NOT_FOUND" }) @event.RawContent = default!; + if (e is { ErrorCode: "M_NOT_FOUND" }) { + if (type == "m.room.name") + @event = new() { + Type = type, + StateKey = stateKey, + TypedContent = new RoomNameEventContent() { + Name = await Room.GetNameOrFallbackAsync() + } + }; + else + @event.RawContent = default!; + } else throw; } @@ -60,7 +71,7 @@ public class RoomInfo : NotifyPropertyChanged { private string? _roomName; private RoomCreateEventContent? _creationEventContent; private string? _roomCreator; - + public string? DefaultRoomName { get; set; } public RoomInfo() { |