aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Users/Extensions.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-03-23 10:14:33 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-03-23 10:14:33 -0500
commit2b64f48bc6acb79bd2844333afea7e7a70d77a22 (patch)
tree89033f1105ec7ed262ed3ef8d17e0af468d8b86d /src/slskd/Users/Extensions.cs
parent78b7cb219b155e9be951b9c6b7ca9eb91ba794b2 (diff)
downloadslskd-2b64f48bc6acb79bd2844333afea7e7a70d77a22.tar.gz
move Info factory to extensions
Diffstat (limited to 'src/slskd/Users/Extensions.cs')
-rw-r--r--src/slskd/Users/Extensions.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/slskd/Users/Extensions.cs b/src/slskd/Users/Extensions.cs
index 846fd125..d2189a20 100644
--- a/src/slskd/Users/Extensions.cs
+++ b/src/slskd/Users/Extensions.cs
@@ -47,5 +47,20 @@ namespace slskd.Users
IsPrivileged = s.IsPrivileged,
Presence = s.Presence,
};
+
+ /// <summary>
+ /// Converts <see cref="Soulseek.UserInfo"/> to <see cref="Info"/>.
+ /// </summary>
+ /// <param name="i">The UserInfo instance to convert.</param>
+ /// <returns>The converted instance.</returns>
+ public static Info ToInfo(this UserInfo i) => new()
+ {
+ Description = i.Description,
+ HasFreeUploadSlot = i.HasFreeUploadSlot,
+ HasPicture = i.HasPicture,
+ Picture = i.Picture,
+ QueueLength = i.QueueLength,
+ UploadSlots = i.UploadSlots,
+ };
}
}