diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-09-20 08:49:19 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-09-20 08:49:19 -0500 |
| commit | ad8f173adf8902ef42e2a1f70c675373cbb06950 (patch) | |
| tree | ebf7c142161d6f96bc093765f4a822d0bc9464d5 /src/slskd/Application/Users/Domain | |
| parent | d7d4b34c8aa560c847c9e4c4a14de65a8826b923 (diff) | |
| download | slskd-ad8f173adf8902ef42e2a1f70c675373cbb06950.tar.gz | |
rename Peer namespace to Users
Diffstat (limited to 'src/slskd/Application/Users/Domain')
| -rw-r--r-- | src/slskd/Application/Users/Domain/Info.cs | 51 | ||||
| -rw-r--r-- | src/slskd/Application/Users/Domain/Status.cs | 36 |
2 files changed, 87 insertions, 0 deletions
diff --git a/src/slskd/Application/Users/Domain/Info.cs b/src/slskd/Application/Users/Domain/Info.cs new file mode 100644 index 00000000..aaf19942 --- /dev/null +++ b/src/slskd/Application/Users/Domain/Info.cs @@ -0,0 +1,51 @@ +// <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 +{ + using System; + using System.ComponentModel.DataAnnotations; + using Soulseek; + + public class Info + { + [Key] + public string Username { get; init; } + 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; } + public DateTime UpdatedAt { get; init; } + + public static Info FromSoulseekUserInfo(string username, UserInfo info) + { + return new Info() + { + Username = username, + Description = info.Description, + HasFreeUploadSlot = info.HasFreeUploadSlot, + HasPicture = info.HasPicture, + Picture = info.Picture, + QueueLength = info.QueueLength, + UploadSlots = info.UploadSlots, + UpdatedAt = DateTime.UtcNow, + }; + } + } +} diff --git a/src/slskd/Application/Users/Domain/Status.cs b/src/slskd/Application/Users/Domain/Status.cs new file mode 100644 index 00000000..41452e66 --- /dev/null +++ b/src/slskd/Application/Users/Domain/Status.cs @@ -0,0 +1,36 @@ +// <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; + + public class Status + { + 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, + }; + } + } +} |
