From 6769b0fd6f37cbc27646fa0ca8e458489c935039 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 9 Dec 2025 23:42:07 +0100 Subject: Commit various changes that never made it into git --- MatrixUtils.Abstractions/RoomInfo.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'MatrixUtils.Abstractions') diff --git a/MatrixUtils.Abstractions/RoomInfo.cs b/MatrixUtils.Abstractions/RoomInfo.cs index 4b2a53c..1efbd6f 100644 --- a/MatrixUtils.Abstractions/RoomInfo.cs +++ b/MatrixUtils.Abstractions/RoomInfo.cs @@ -16,22 +16,22 @@ public class RoomInfo : NotifyPropertyChanged { RegisterEventListener(); } - public RoomInfo(GenericRoom room, List? stateEvents) { + public RoomInfo(GenericRoom room, List? stateEvents) { Room = room; // _fallbackIcon = identiconGenerator.GenerateAsDataUri(room.RoomId); if (stateEvents is { Count: > 0 }) StateEvents = new(stateEvents!); RegisterEventListener(); ProcessNewItems(stateEvents!); } - + public readonly GenericRoom Room; - public ObservableCollection StateEvents { get; private set; } = new(); - public ObservableCollection Timeline { get; private set; } = new(); + public ObservableCollection StateEvents { get; private set; } = new(); + public ObservableCollection Timeline { get; private set; } = new(); private static ConcurrentBag homeserversWithoutEventFormatSupport = new(); // private static SvgIdenticonGenerator identiconGenerator = new(); - public async Task GetStateEvent(string type, string stateKey = "") { + public async Task GetStateEvent(string type, string stateKey = "") { if (homeserversWithoutEventFormatSupport.Contains(Room.Homeserver)) return await GetStateEventForged(type, stateKey); var @event = StateEvents.FirstOrDefault(x => x?.Type == type && x.StateKey == stateKey); if (@event is not null) return @event; @@ -54,8 +54,8 @@ public class RoomInfo : NotifyPropertyChanged { return @event; } - private async Task GetStateEventForged(string type, string stateKey = "") { - var @event = new StateEventResponse { + private async Task GetStateEventForged(string type, string stateKey = "") { + var @event = new MatrixEventResponse { RoomId = Room.RoomId, Type = type, StateKey = stateKey, @@ -148,16 +148,16 @@ public class RoomInfo : NotifyPropertyChanged { private void RegisterEventListener() { StateEvents.CollectionChanged += (_, args) => { if (args.NewItems is { Count: > 0 }) - ProcessNewItems(args.NewItems.OfType()); + ProcessNewItems(args.NewItems.OfType()); }; } - private void ProcessNewItems(IEnumerable newItems) { - foreach (StateEventResponse? newState in newItems) { + private void ProcessNewItems(IEnumerable newItems) { + foreach (MatrixEventResponse? newState in newItems) { if (newState is null) continue; // TODO: Benchmark switch statement - - if(newState.StateKey != "") continue; + + if (newState.StateKey != "") continue; if (newState.Type == RoomNameEventContent.EventId && newState.TypedContent is RoomNameEventContent roomNameContent) RoomName = roomNameContent.Name; else if (newState is { Type: RoomAvatarEventContent.EventId, TypedContent: RoomAvatarEventContent roomAvatarContent }) -- cgit 1.5.1