From c37bcb0e4a878d4f4c0e47988adb8624131c82cd Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 9 Nov 2023 07:38:33 +0100 Subject: event types --- MatrixRoomUtils.Web/Classes/MRUStorageWrapper.cs | 4 ++-- MatrixRoomUtils.Web/Classes/RoomInfo.cs | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'MatrixRoomUtils.Web/Classes') diff --git a/MatrixRoomUtils.Web/Classes/MRUStorageWrapper.cs b/MatrixRoomUtils.Web/Classes/MRUStorageWrapper.cs index b6836c8..2c3b9ce 100644 --- a/MatrixRoomUtils.Web/Classes/MRUStorageWrapper.cs +++ b/MatrixRoomUtils.Web/Classes/MRUStorageWrapper.cs @@ -43,11 +43,11 @@ public class MRUStorageWrapper(TieredStorageService storageService, HomeserverPr return null; } - return await homeserverProviderService.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken); + return await homeserverProviderService.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken, token.Proxy); } public async Task GetSession(UserAuth userAuth) { - return await homeserverProviderService.GetAuthenticatedWithToken(userAuth.Homeserver, userAuth.AccessToken); + return await homeserverProviderService.GetAuthenticatedWithToken(userAuth.Homeserver, userAuth.AccessToken, userAuth.Proxy); } public async Task GetCurrentSessionOrNavigate() { 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(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() { -- cgit 1.5.1