From 71d115dc8e915a620dd935955ba980fcbe421dad Mon Sep 17 00:00:00 2001 From: "Emma [it/its]@Rory&" Date: Fri, 1 Dec 2023 12:16:00 +0100 Subject: Cleanup, move ArcaneLibs to submodule instead of parent submodule --- LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | 14 +++++++------- LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs | 12 ++++++------ LibMatrix/Homeservers/RemoteHomeServer.cs | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'LibMatrix/Homeservers') diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index 288608d..e85ecd2 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -136,7 +136,7 @@ public class AuthenticatedHomeserverGeneric(string serverName, string accessToke } } -#region Utility Functions + #region Utility Functions public virtual async IAsyncEnumerable GetJoinedRoomsByType(string type) { var rooms = await GetJoinedRooms(); @@ -154,9 +154,9 @@ public class AuthenticatedHomeserverGeneric(string serverName, string accessToke } } -#endregion + #endregion -#region Account Data + #region Account Data public virtual async Task GetAccountDataAsync(string key) { // var res = await _httpClient.GetAsync($"/_matrix/client/v3/user/{UserId}/account_data/{key}"); @@ -177,7 +177,7 @@ public class AuthenticatedHomeserverGeneric(string serverName, string accessToke } } -#endregion + #endregion public async Task UpdateProfileAsync(UserProfileResponse? newProfile, bool preserveCustomRoomProfile = true) { if (newProfile is null) return; @@ -299,11 +299,11 @@ public class AuthenticatedHomeserverGeneric(string serverName, string accessToke return await res.Content.ReadFromJsonAsync() ?? throw new Exception("Failed to join room?"); } -#region Room Profile Utility + #region Room Profile Utility private async Task> GetOwnRoomProfileWithIdAsync(GenericRoom room) { return new KeyValuePair(room.RoomId, await room.GetStateAsync("m.room.member", WhoAmI.UserId!)); } -#endregion -} \ No newline at end of file + #endregion +} diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs index 15e5b65..28ff775 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs @@ -52,29 +52,29 @@ public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric { totalRooms--; continue; } - if(!room.GuestAccess?.Contains(localFilter.GuestAccessContains) == true) { + if (!room.GuestAccess?.Contains(localFilter.GuestAccessContains) == true) { totalRooms--; continue; } - if(!room.HistoryVisibility?.Contains(localFilter.HistoryVisibilityContains) == true) { + if (!room.HistoryVisibility?.Contains(localFilter.HistoryVisibilityContains) == true) { totalRooms--; continue; } - if(localFilter.CheckFederation && room.Federatable != localFilter.Federatable) { + if (localFilter.CheckFederation && room.Federatable != localFilter.Federatable) { totalRooms--; continue; } - if(localFilter.CheckPublic && room.Public != localFilter.Public) { + if (localFilter.CheckPublic && room.Public != localFilter.Public) { totalRooms--; continue; } - if(room.JoinedMembers < localFilter.JoinedMembersGreaterThan || room.JoinedMembers > localFilter.JoinedMembersLessThan) { + if (room.JoinedMembers < localFilter.JoinedMembersGreaterThan || room.JoinedMembers > localFilter.JoinedMembersLessThan) { totalRooms--; continue; } - if(room.JoinedLocalMembers < localFilter.JoinedLocalMembersGreaterThan || room.JoinedLocalMembers > localFilter.JoinedLocalMembersLessThan) { + if (room.JoinedLocalMembers < localFilter.JoinedLocalMembersGreaterThan || room.JoinedLocalMembers > localFilter.JoinedLocalMembersLessThan) { totalRooms--; continue; } diff --git a/LibMatrix/Homeservers/RemoteHomeServer.cs b/LibMatrix/Homeservers/RemoteHomeServer.cs index 55a3a02..f8d61fd 100644 --- a/LibMatrix/Homeservers/RemoteHomeServer.cs +++ b/LibMatrix/Homeservers/RemoteHomeServer.cs @@ -68,7 +68,7 @@ public class RemoteHomeserver(string baseUrl) { return data; } -#region Authentication + #region Authentication public async Task LoginAsync(string username, string password, string? deviceName = null) { var resp = await ClientHttpClient.PostAsJsonAsync("/_matrix/client/r0/login", new { @@ -102,13 +102,13 @@ public class RemoteHomeserver(string baseUrl) { return data; } -#endregion + #endregion public async Task GetServerVersionAsync() { return await ServerHttpClient.GetFromJsonAsync("/_matrix/federation/v1/version"); } - - + + public string? ResolveMediaUri(string? mxcUri) { if (mxcUri is null) return null; if (mxcUri.StartsWith("https://")) return mxcUri; @@ -120,11 +120,11 @@ public class ServerVersionResponse { [JsonPropertyName("server")] public ServerInfo Server { get; set; } - + public class ServerInfo { [JsonPropertyName("name")] public string Name { get; set; } - + [JsonPropertyName("version")] public string Version { get; set; } } -- cgit 1.4.1