aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Users/Domain
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-02-25 09:47:06 -0600
committerGitHub <noreply@github.com>2022-02-25 09:47:06 -0600
commit8c7861a0dfc2fd25379e03e1f23b4ae561206fc3 (patch)
tree6a3ae3d3cb2cc7d68f81a4cdd82d76f31516d0af /src/slskd/Users/Domain
parentda7589fb77be63657b69209386743a008b2ae3d3 (diff)
parent38bb2f3a021120963be657cf2b363b25bfaa4043 (diff)
downloadslskd-8c7861a0dfc2fd25379e03e1f23b4ae561206fc3.tar.gz
Merge pull request #364 from slskd/privileges
Identify privileged users
Diffstat (limited to 'src/slskd/Users/Domain')
-rw-r--r--src/slskd/Users/Domain/Statistics.cs42
-rw-r--r--src/slskd/Users/Domain/Status.cs21
-rw-r--r--src/slskd/Users/Domain/User.cs42
3 files changed, 95 insertions, 10 deletions
diff --git a/src/slskd/Users/Domain/Statistics.cs b/src/slskd/Users/Domain/Statistics.cs
new file mode 100644
index 00000000..a415d3d5
--- /dev/null
+++ b/src/slskd/Users/Domain/Statistics.cs
@@ -0,0 +1,42 @@
+// <copyright file="Statistics.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Users
+{
+ public record Statistics
+ {
+ /// <summary>
+ /// Gets the average upload speed of the user.
+ /// </summary>
+ public int AverageSpeed { get; init; }
+
+ /// <summary>
+ /// Gets the number of directories shared by the user.
+ /// </summary>
+ public int DirectoryCount { get; init; }
+
+ /// <summary>
+ /// Gets the number of files shared by the user.
+ /// </summary>
+ public int FileCount { get; init; }
+
+ /// <summary>
+ /// Gets the number of uploads tracked by the server for this user.
+ /// </summary>
+ public long UploadCount { get; init; }
+ }
+}
diff --git a/src/slskd/Users/Domain/Status.cs b/src/slskd/Users/Domain/Status.cs
index 41452e66..890afb74 100644
--- a/src/slskd/Users/Domain/Status.cs
+++ b/src/slskd/Users/Domain/Status.cs
@@ -19,18 +19,19 @@ namespace slskd.Users
{
using Soulseek;
- public class Status
+ /// <summary>
+ /// User status.
+ /// </summary>
+ public record Status
{
+ /// <summary>
+ /// Gets a value indicating whether the user is privileged.
+ /// </summary>
public bool IsPrivileged { get; init; }
- public UserPresence Presence { get; init; }
- public static Status FromSoulseekUserStatus(UserStatus status)
- {
- return new Status()
- {
- IsPrivileged = status.IsPrivileged,
- Presence = status.Presence,
- };
- }
+ /// <summary>
+ /// Gets the user's presence.
+ /// </summary>
+ public UserPresence Presence { get; init; }
}
}
diff --git a/src/slskd/Users/Domain/User.cs b/src/slskd/Users/Domain/User.cs
new file mode 100644
index 00000000..2913620c
--- /dev/null
+++ b/src/slskd/Users/Domain/User.cs
@@ -0,0 +1,42 @@
+// <copyright file="User.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd.Users
+{
+ public record User
+ {
+ /// <summary>
+ /// Gets the username of the user.
+ /// </summary>
+ public string Username { get; init; }
+
+ /// <summary>
+ /// Gets the user's configured group.
+ /// </summary>
+ public string Group { get; init; }
+
+ /// <summary>
+ /// Gets the user's statistics.
+ /// </summary>
+ public Statistics Statistics { get; init; }
+
+ /// <summary>
+ /// Gets the user's status.
+ /// </summary>
+ public Status Status { get; init; }
+ }
+}