diff options
Diffstat (limited to 'LibMatrix/RoomTypes')
-rw-r--r-- | LibMatrix/RoomTypes/GenericRoom.cs | 10 | ||||
-rw-r--r-- | LibMatrix/RoomTypes/SpaceRoom.cs | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs index b935b9d..df1eb52 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs @@ -100,8 +100,8 @@ public class GenericRoom { public async IAsyncEnumerable<StateEventResponse> GetMembersAsync(bool joinedOnly = true) { var res = GetFullStateAsync(); await foreach (var member in res) { - if (member.Type != "m.room.member") continue; - if (joinedOnly && (member.TypedContent as RoomMemberEventData).Membership is not "join") continue; + if (member?.Type != "m.room.member") continue; + if (joinedOnly && (member.TypedContent as RoomMemberEventData)?.Membership is not "join") continue; yield return member; } } @@ -147,15 +147,15 @@ public class GenericRoom { public async Task KickAsync(string userId, string? reason = null) => await _httpClient.PostAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/kick", - new UserIdAndReason() { UserId = userId, Reason = reason }); + new UserIdAndReason { UserId = userId, Reason = reason }); public async Task BanAsync(string userId, string? reason = null) => await _httpClient.PostAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/ban", - new UserIdAndReason() { UserId = userId, Reason = reason }); + new UserIdAndReason { UserId = userId, Reason = reason }); public async Task UnbanAsync(string userId) => await _httpClient.PostAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/unban", - new UserIdAndReason() { UserId = userId }); + new UserIdAndReason { UserId = userId }); public async Task<EventIdResponse> SendStateEventAsync(string eventType, object content) => await (await _httpClient.PostAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/state/{eventType}", content)) diff --git a/LibMatrix/RoomTypes/SpaceRoom.cs b/LibMatrix/RoomTypes/SpaceRoom.cs index ff2c228..5393ee7 100644 --- a/LibMatrix/RoomTypes/SpaceRoom.cs +++ b/LibMatrix/RoomTypes/SpaceRoom.cs @@ -3,7 +3,7 @@ using LibMatrix.Extensions; namespace LibMatrix.RoomTypes; public class SpaceRoom : GenericRoom { - private readonly AuthenticatedHomeServer _homeServer; + private new readonly AuthenticatedHomeServer _homeServer; private readonly GenericRoom _room; public SpaceRoom(AuthenticatedHomeServer homeServer, string roomId) : base(homeServer, roomId) { |