about summary refs log tree commit diff
path: root/LibMatrix
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-09-16 08:46:54 +0200
committerRory& <root@rory.gay>2024-09-16 08:46:54 +0200
commit3346c55e34d4f3f847dfe8113cb367e4bc72a2e5 (patch)
treea3b5b9a3bb3c443bf142c00a6723f54411cbdedf /LibMatrix
parentAuthenticated media foundations (diff)
downloadLibMatrix-3346c55e34d4f3f847dfe8113cb367e4bc72a2e5.tar.xz
Fix room joining, power levels
Diffstat (limited to 'LibMatrix')
-rw-r--r--LibMatrix/RoomTypes/GenericRoom.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs
index b22ce2f..4641349 100644
--- a/LibMatrix/RoomTypes/GenericRoom.cs
+++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -210,10 +210,11 @@ public class GenericRoom {
     public async Task<RoomIdResponse> JoinAsync(string[]? homeservers = null, string? reason = null, bool checkIfAlreadyMember = true) {
         if (checkIfAlreadyMember)
             try {
-                _ = await GetCreateEventAsync();
-                return new RoomIdResponse {
-                    RoomId = RoomId
-                };
+                var ser = await GetStateEventOrNullAsync(RoomMemberEventContent.EventId, Homeserver.UserId);
+                if (ser?.TypedContent is RoomMemberEventContent { Membership: "join" })
+                    return new RoomIdResponse {
+                        RoomId = RoomId
+                    };
             }
             catch { } //ignore