From aa5d96cae4e38f7617a38b15f234d671d8fd4ba6 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 1 Jan 2024 14:46:00 -0600 Subject: on second thought, don't remove users from state --- src/slskd/Application.cs | 5 +++++ src/slskd/Core/State.cs | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'src') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 59aa1d40..d0e34880 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -74,6 +74,11 @@ namespace slskd /// public static readonly string LeecherGroup = "leechers"; + /// + /// The name of the blacklisted user group. + /// + public static readonly string BlacklistedGroup = "blacklisted"; + private static readonly string ApplicationShutdownTransferExceptionMessage = "Application shut down"; public Application( diff --git a/src/slskd/Core/State.cs b/src/slskd/Core/State.cs index 3a0c8c11..9ae6df6b 100644 --- a/src/slskd/Core/State.cs +++ b/src/slskd/Core/State.cs @@ -23,6 +23,7 @@ namespace slskd using System.Net; using System.Text.Json.Serialization; using slskd.Relay; + using slskd.Users; using Soulseek; /// @@ -35,9 +36,11 @@ namespace slskd public bool PendingRestart { get; init; } public ServerState Server { get; init; } = new ServerState(); public RelayState Relay { get; init; } = new RelayState(); + public UserState User { get; init; } = new UserState(); public DistributedNetworkState DistributedNetwork { get; init; } = new DistributedNetworkState(); public ShareState Shares { get; init; } = new ShareState(); public string[] Rooms { get; init; } = Array.Empty(); + public User[] Users { get; init; } = Array.Empty(); } public record VersionState @@ -75,6 +78,27 @@ namespace slskd public RelayClientState State { get; init; } = RelayClientState.Disconnected; } + public record UserState + { + public string Username { get; init; } + public UserPrivilegeState Privileges { get; init; } = new UserPrivilegeState(); + public UserStatisticsState Statistics { get; init; } = new UserStatisticsState(); + } + + public record UserPrivilegeState + { + public bool IsPrivileged { get; init; } + public int PrivilegesRemaining { get; init; } + } + + public record UserStatisticsState + { + public int AverageSpeed { get; init; } + public int DirectoryCount { get; init; } + public int FileCount { get; init; } + public long UploadCount { get; init; } + } + public record DistributedNetworkState { public int BranchLevel { get; init; } -- cgit v1.2.3