diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-29 08:27:47 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-06-29 08:27:47 -0500 |
| commit | 941c79e26fe45a2fd75ccb30c9c90a39b72c5562 (patch) | |
| tree | 91b89ff122730d80fa1cd2fbf8c91ed49d3d732a /src | |
| parent | ac6f113e36476fe25016a5ae073bc18be91301fd (diff) | |
| download | slskd-941c79e26fe45a2fd75ccb30c9c90a39b72c5562.tar.gz | |
add UserState and move some things around
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/State.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/slskd/Core/State.cs b/src/slskd/Core/State.cs index b15ce7fa..e009805a 100644 --- a/src/slskd/Core/State.cs +++ b/src/slskd/Core/State.cs @@ -34,6 +34,7 @@ namespace slskd public bool PendingReconnect { get; init; } public bool PendingRestart { get; init; } public ServerState Server { get; init; } = new ServerState(); + 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<string>(); @@ -57,13 +58,32 @@ namespace slskd [JsonConverter(typeof(IPEndPointConverter))] public IPEndPoint IPEndPoint { get; init; } public SoulseekClientStates State { get; init; } - public string Username { get; init; } - public UserStatistics Statistics { get; init; } public bool IsConnected => State.HasFlag(SoulseekClientStates.Connected); public bool IsLoggedIn => State.HasFlag(SoulseekClientStates.LoggedIn); public bool IsTransitioning => State.HasFlag(SoulseekClientStates.Connecting) || State.HasFlag(SoulseekClientStates.Disconnecting) || State.HasFlag(SoulseekClientStates.LoggingIn); } + 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; } |
