From 851dcdfa4824d6b06287959d89484db16f3a4d91 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 26 Jun 2022 15:37:34 -0500 Subject: move stuff again --- src/slskd/Users/Types/Info.cs | 29 +++++++++++++++++++++++++ src/slskd/Users/Types/Statistics.cs | 42 +++++++++++++++++++++++++++++++++++++ src/slskd/Users/Types/Status.cs | 37 ++++++++++++++++++++++++++++++++ src/slskd/Users/Types/User.cs | 42 +++++++++++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 src/slskd/Users/Types/Info.cs create mode 100644 src/slskd/Users/Types/Statistics.cs create mode 100644 src/slskd/Users/Types/Status.cs create mode 100644 src/slskd/Users/Types/User.cs (limited to 'src/slskd/Users/Types') 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 (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/. +// + +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 (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/. +// + +namespace slskd.Users +{ + public record Statistics + { + /// + /// Gets the average upload speed of the user. + /// + public int AverageSpeed { get; init; } + + /// + /// Gets the number of directories shared by the user. + /// + public int DirectoryCount { get; init; } + + /// + /// Gets the number of files shared by the user. + /// + public int FileCount { get; init; } + + /// + /// Gets the number of uploads tracked by the server for this user. + /// + 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 (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/. +// + +namespace slskd.Users +{ + using Soulseek; + + /// + /// User status. + /// + public record Status + { + /// + /// Gets a value indicating whether the user is privileged. + /// + public bool IsPrivileged { get; init; } + + /// + /// Gets the user's presence. + /// + 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 (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/. +// + +namespace slskd.Users +{ + public record User + { + /// + /// Gets the username of the user. + /// + public string Username { get; init; } + + /// + /// Gets the user's configured group. + /// + public string Group { get; init; } + + /// + /// Gets the user's statistics. + /// + public Statistics Statistics { get; init; } + + /// + /// Gets the user's status. + /// + public Status Status { get; init; } + } +} -- cgit v1.2.3