From 30a0868789466012bab869af4300aef5a9cac108 Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 30 May 2024 09:46:43 +0000 Subject: Rename legacy event types --- LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs') diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index 86977ec..db76985 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -190,7 +190,7 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { if (newProfile is null) return; Console.WriteLine($"Updating profile for {WhoAmI.UserId} to {newProfile.ToJson(ignoreNull: true)} (preserving room profiles: {preserveCustomRoomProfile})"); var oldProfile = await GetProfileAsync(WhoAmI.UserId!); - Dictionary expectedRoomProfiles = new(); + Dictionary expectedRoomProfiles = new(); var syncHelper = new SyncHelper(this) { Filter = new SyncFilter { AccountData = new SyncFilter.EventFilter() { @@ -209,7 +209,7 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { targetSyncCount = rooms.Count; await foreach (var (roomId, currentRoomProfile) in roomProfiles) try { - // var currentRoomProfile = await room.GetStateAsync("m.room.member", WhoAmI.UserId!); + // var currentRoomProfile = await room.GetStateAsync("m.room.member", WhoAmI.UserId!); //build new profiles if (currentRoomProfile.DisplayName == oldProfile.DisplayName) currentRoomProfile.DisplayName = newProfile.DisplayName; @@ -243,7 +243,7 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { foreach (var (roomId, roomData) in sync.Rooms.Join) if (roomData.State is { Events.Count: > 0 }) { var incommingRoomProfile = - roomData.State?.Events?.FirstOrDefault(x => x.Type == "m.room.member" && x.StateKey == WhoAmI.UserId)?.TypedContent as RoomMemberEventContent; + roomData.State?.Events?.FirstOrDefault(x => x.Type == "m.room.member" && x.StateKey == WhoAmI.UserId)?.TypedContent as RoomMemberLegacyEventContent; if (incommingRoomProfile is null) continue; if (!expectedRoomProfiles.ContainsKey(roomId)) continue; var targetRoomProfileOverride = expectedRoomProfiles[roomId]; @@ -276,7 +276,7 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { } } - public async IAsyncEnumerable> GetRoomProfilesAsync() { + public async IAsyncEnumerable> GetRoomProfilesAsync() { var rooms = await GetJoinedRooms(); var results = rooms.Select(GetOwnRoomProfileWithIdAsync).ToAsyncEnumerable(); await foreach (var res in results) yield return res; @@ -295,8 +295,8 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { #region Room Profile Utility - private async Task> GetOwnRoomProfileWithIdAsync(GenericRoom room) => - new(room.RoomId, await room.GetStateAsync("m.room.member", WhoAmI.UserId!)); + private async Task> GetOwnRoomProfileWithIdAsync(GenericRoom room) => + new(room.RoomId, await room.GetStateAsync("m.room.member", WhoAmI.UserId!)); #endregion -- cgit 1.4.1