about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-13 01:49:10 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-06-13 01:49:10 +0200
commitfc749b3e57098740377e6eabd5d010d133256fa5 (patch)
treecc97267a3d4222c910769e46bdb37c96c7c31531 /MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
parentunknown changes (diff)
downloadMatrixUtils-fc749b3e57098740377e6eabd5d010d133256fa5.tar.xz
Improved many features
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());
         }
     }