about summary refs log tree commit diff
path: root/LibMatrix/RoomTypes
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-09-21 15:49:54 +0200
committerRory& <root@rory.gay>2025-09-21 15:49:54 +0200
commit91319ba62de889bde645b6f1df4dd6a960ee7de4 (patch)
treed383dcce55321343452e03ee9404303fe77fd70a /LibMatrix/RoomTypes
parentBulk sending, policy interpreting improvements, room upgrade builder work (diff)
downloadLibMatrix-master.tar.xz
Dependency updates, some fixes, partial msc2545 support HEAD master
Diffstat (limited to 'LibMatrix/RoomTypes')
-rw-r--r--LibMatrix/RoomTypes/GenericRoom.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs

index 0077acb..58e5434 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -704,6 +704,18 @@ public class GenericRoom { } public async Task<List<string>> GetHomeserversInRoom() => (await GetMemberIdsListAsync("join")).Select(x => x.Split(':', 2)[1]).Distinct().ToList(); + + public async Task<bool> IsJoinedAsync() { + try { + var member = await GetStateOrNullAsync<RoomMemberEventContent>(RoomMemberEventContent.EventId, Homeserver.UserId); + return member?.Membership == "join"; + } + catch (MatrixException e) { + if (e.ErrorCode == "M_NOT_FOUND") return false; + if (e.ErrorCode == "M_FORBIDDEN") return false; + throw; + } + } } public class RoomIdResponse {