about summary refs log tree commit diff
path: root/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
commit4ef9ae4b396b0eb37036d4008e8cb40e468dbe73 (patch)
tree6bb4d25754fefc52333a5fc44dd721c333314240 /LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs
parentConsistently use EventId for event types (diff)
downloadLibMatrix-4ef9ae4b396b0eb37036d4008e8cb40e468dbe73.tar.xz
Apply syntax style to LibMatrix
Diffstat (limited to 'LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs')
-rw-r--r--LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs20
1 files changed, 15 insertions, 5 deletions
diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs
index 6562686..8df0c5b 100644
--- a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs
+++ b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs
@@ -6,8 +6,10 @@ namespace LibMatrix.Homeservers;
 
 public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric {
     public readonly SynapseAdminApi Admin;
+
     public class SynapseAdminApi(AuthenticatedHomeserverSynapse authenticatedHomeserver) {
-        public async IAsyncEnumerable<AdminRoomListingResult.AdminRoomListingResultRoom> SearchRoomsAsync(int limit = int.MaxValue, string orderBy = "name", string dir = "f", string? searchTerm = null, LocalRoomQueryFilter? localFilter = null) {
+        public async IAsyncEnumerable<AdminRoomListingResult.AdminRoomListingResultRoom> SearchRoomsAsync(int limit = int.MaxValue, string orderBy = "name", string dir = "f",
+            string? searchTerm = null, LocalRoomQueryFilter? localFilter = null) {
             AdminRoomListingResult? res = null;
             var i = 0;
             int? totalRooms = null;
@@ -28,34 +30,42 @@ public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.Name?.Contains(localFilter.NameContains) == true) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.CanonicalAlias?.Contains(localFilter.CanonicalAliasContains) == true) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.Version.Contains(localFilter.VersionContains)) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.Creator.Contains(localFilter.CreatorContains)) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.Encryption?.Contains(localFilter.EncryptionContains) == true) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.JoinRules?.Contains(localFilter.JoinRulesContains) == true) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.GuestAccess?.Contains(localFilter.GuestAccessContains) == true) {
                             totalRooms--;
                             continue;
                         }
+
                         if (!room.HistoryVisibility?.Contains(localFilter.HistoryVisibilityContains) == true) {
                             totalRooms--;
                             continue;
@@ -65,6 +75,7 @@ public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric {
                             totalRooms--;
                             continue;
                         }
+
                         if (localFilter.CheckPublic && room.Public != localFilter.Public) {
                             totalRooms--;
                             continue;
@@ -74,6 +85,7 @@ public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric {
                             totalRooms--;
                             continue;
                         }
+
                         if (room.JoinedLocalMembers < localFilter.JoinedLocalMembersGreaterThan || room.JoinedLocalMembers > localFilter.JoinedLocalMembersLessThan) {
                             totalRooms--;
                             continue;
@@ -97,7 +109,5 @@ public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric {
         }
     }
 
-    public AuthenticatedHomeserverSynapse(string serverName, string accessToken) : base(serverName, accessToken) {
-        Admin = new(this);
-    }
-}
+    public AuthenticatedHomeserverSynapse(string serverName, string accessToken) : base(serverName, accessToken) => Admin = new SynapseAdminApi(this);
+}
\ No newline at end of file