about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor13
1 files changed, 11 insertions, 2 deletions
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
index e9d1421..1e7e065 100644
--- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
@@ -29,6 +29,7 @@
     
     private StateEventResponse<object>[] States { get; set; } = Array.Empty<StateEventResponse<object>>();
     private List<Room> Rooms { get; set; } = new();
+    private List<string> ServersInSpace { get; set; } = new();
     
     protected override async Task OnInitializedAsync()
     {
@@ -37,7 +38,7 @@
         var state = await Room.GetStateAsync("");
         if (state != null)
         {
-            Console.WriteLine(state.Value.ToJson());
+            // Console.WriteLine(state.Value.ToJson());
             States = state.Value.Deserialize<StateEventResponse<object>[]>()!;
             
             foreach (var stateEvent in States)
@@ -52,6 +53,14 @@
                         Rooms.Add(room);
                     }
                 }
+                else if (stateEvent.Type == "m.room.member")
+                {
+                    var serverName = stateEvent.StateKey.Split(':').Last();
+                    if (!ServersInSpace.Contains(serverName))
+                    {
+                        ServersInSpace.Add(serverName);
+                    }
+                }
             }
             
         // if(state.Value.TryGetProperty("Type", out var Type))
@@ -70,7 +79,7 @@
     {
         foreach (var room in Rooms)
         {
-            room.JoinAsync();
+            room.JoinAsync(ServersInSpace.ToArray());
         }
     }