diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-28 10:36:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-28 10:36:12 -0500 |
| commit | 77df3572c381150dc60454be03ca3176a940a628 (patch) | |
| tree | bd28e93414bc580fac30619a994756ad1193d99b /src/slskd/Users/Types | |
| parent | 18e5c8dd9a98862422a46221f99a1091a9314381 (diff) | |
| parent | 1d211e640b8677753be7fee06f640f43863f8e68 (diff) | |
| download | slskd-77df3572c381150dc60454be03ca3176a940a628.tar.gz | |
Merge pull request #534 from slskd/send-stats
Include upload slot and approximate queue position with search results
Diffstat (limited to 'src/slskd/Users/Types')
| -rw-r--r-- | src/slskd/Users/Types/Info.cs | 29 | ||||
| -rw-r--r-- | src/slskd/Users/Types/Statistics.cs | 42 | ||||
| -rw-r--r-- | src/slskd/Users/Types/Status.cs | 37 | ||||
| -rw-r--r-- | src/slskd/Users/Types/User.cs | 42 |
4 files changed, 150 insertions, 0 deletions
diff --git a/src/slskd/Users/Types/Info.cs b/src/slskd/Users/Types/Info.cs new file mode 100644 index 00000000..e3969f17 --- /dev/null +++ b/src/slskd/Users/Types/Info.cs @@ -0,0 +1,29 @@ +// <copyright file="Info.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 Info + { + public string Description { get; init; } + public bool HasFreeUploadSlot { get; init; } + public bool HasPicture { get; init; } + public byte[] Picture { get; init; } + public int QueueLength { get; init; } + public int UploadSlots { get; init; } + } +} diff --git a/src/slskd/Users/Types/Statistics.cs b/src/slskd/Users/Types/Statistics.cs new file mode 100644 index 00000000..a415d3d5 --- /dev/null +++ b/src/slskd/Users/Types/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/Types/Status.cs b/src/slskd/Users/Types/Status.cs new file mode 100644 index 00000000..890afb74 --- /dev/null +++ b/src/slskd/Users/Types/Status.cs @@ -0,0 +1,37 @@ +// <copyright file="Status.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 +{ + using Soulseek; + + /// <summary> + /// User status. + /// </summary> + public record Status + { + /// <summary> + /// Gets a value indicating whether the user is privileged. + /// </summary> + public bool IsPrivileged { get; init; } + + /// <summary> + /// Gets the user's presence. + /// </summary> + public UserPresence Presence { get; init; } + } +} diff --git a/src/slskd/Users/Types/User.cs b/src/slskd/Users/Types/User.cs new file mode 100644 index 00000000..2913620c --- /dev/null +++ b/src/slskd/Users/Types/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; } + } +} |
