From 32b6e44f6db7a77905e45e7bbbe94f91be02fdee Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 12 Sep 2021 11:07:19 -0500 Subject: remove ISoulseekClient from PeerService --- src/slskd/Application/Peer/PeerService.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/slskd/Application/Peer') diff --git a/src/slskd/Application/Peer/PeerService.cs b/src/slskd/Application/Peer/PeerService.cs index e0e03fa6..96d65bd5 100644 --- a/src/slskd/Application/Peer/PeerService.cs +++ b/src/slskd/Application/Peer/PeerService.cs @@ -22,7 +22,6 @@ namespace slskd.Peer using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; - using ISoulseekClient = Soulseek.ISoulseekClient; /// /// Provides information and operations for network peers. @@ -34,20 +33,20 @@ namespace slskd.Peer /// /// Initializes a new instance of the class. /// - /// The client instance to use. + /// /// The database context to use. /// The logger. public PeerService( - ISoulseekClient client, + IApplication application, IDbContextFactory contextFactory, ILogger log) { - Client = client; + Application = application; ContextFactory = contextFactory; Log = log; } - private ISoulseekClient Client { get; } + private IApplication Application { get; } private IDbContextFactory ContextFactory { get; } private ILogger Log { get; set; } @@ -69,7 +68,7 @@ namespace slskd.Peer return info; } - var soulseekUserInfo = await Client.GetUserInfoAsync(username); + var soulseekUserInfo = await Application.GetUserInfoAsync(username); info = Info.FromSoulseekUserInfo(username, soulseekUserInfo); if (peerExists) @@ -93,7 +92,7 @@ namespace slskd.Peer /// The retrieved endpoint. public Task GetIPEndPointAsync(string username) { - return Client.GetUserEndPointAsync(username); + return Application.GetUserEndPointAsync(username); } /// @@ -103,7 +102,7 @@ namespace slskd.Peer /// The retrieved status. public async Task GetStatusAsync(string username) { - var soulseekStatus = await Client.GetUserStatusAsync(username); + var soulseekStatus = await Application.GetUserStatusAsync(username); return Status.FromSoulseekUserStatus(soulseekStatus); } @@ -115,7 +114,7 @@ namespace slskd.Peer /// The number of days to grant. /// The operation context. public Task GrantPrivilegesAsync(string username, int days) - => Client.GrantUserPrivilegesAsync(username, days); + => Application.GrantUserPrivilegesAsync(username, days); /// /// Retrieves a value indicating whether the specified peer is privileged. @@ -123,7 +122,7 @@ namespace slskd.Peer /// The username of the peer. /// A value indicating whether the specified peer is privileged. public Task IsPrivilegedAsync(string username) - => Client.GetUserPrivilegedAsync(username); + => Application.GetUserPrivilegedAsync(username); /// /// Adds the specified username to the server-side user list. @@ -132,7 +131,7 @@ namespace slskd.Peer /// The operation context. public async Task WatchAsync(string username) { - await Client.AddUserAsync(username); + await Application.AddUserAsync(username); } } } \ No newline at end of file -- cgit v1.2.3