aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-12-27 11:16:13 -0600
committerJP Dillingham <jp@dillingham.me>2022-12-27 11:16:13 -0600
commit909b6e532721936e82914712d6228b62619d2fc1 (patch)
tree7bdb98662d6e26b35af6dfb271dacd02622f7487 /src
parent2d2c82e84fa8b2efacd431c42eeb3d106c85bd40 (diff)
downloadslskd-909b6e532721936e82914712d6228b62619d2fc1.tar.gz
remove deprecated ConversationTracker
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Messaging/ConversationTracker.cs62
-rw-r--r--src/slskd/Messaging/IConversationTracker.cs55
-rw-r--r--src/slskd/Program.cs1
3 files changed, 0 insertions, 118 deletions
diff --git a/src/slskd/Messaging/ConversationTracker.cs b/src/slskd/Messaging/ConversationTracker.cs
deleted file mode 100644
index 27d678ca..00000000
--- a/src/slskd/Messaging/ConversationTracker.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// <copyright file="ConversationTracker.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.Messaging
-{
- using System.Collections.Concurrent;
- using System.Collections.Generic;
-
- /// <summary>
- /// Tracks private message conversations.
- /// </summary>
- public class ConversationTracker : IConversationTracker
- {
- /// <summary>
- /// Tracked private message conversations.
- /// </summary>
- public ConcurrentDictionary<string, IList<PrivateMessage>> Conversations { get; } = new ConcurrentDictionary<string, IList<PrivateMessage>>();
-
- /// <summary>
- /// Adds a private message conversation and appends the specified <paramref name="message"/>, or just appends the
- /// message if the conversation exists.
- /// </summary>
- /// <param name="username"></param>
- /// <param name="message"></param>
- public void AddOrUpdate(string username, PrivateMessage message)
- {
- Conversations.AddOrUpdate(username, new List<PrivateMessage>() { message }, (_, messageList) =>
- {
- messageList.Add(message);
- return messageList;
- });
- }
-
- /// <summary>
- /// Returns the list of private messages for the specified <paramref name="username"/>, if any exist.
- /// </summary>
- /// <param name="username"></param>
- /// <param name="messages"></param>
- /// <returns></returns>
- public bool TryGet(string username, out IList<PrivateMessage> messages) => Conversations.TryGetValue(username, out messages);
-
- /// <summary>
- /// Removes a tracked private message conversation for the specified user.
- /// </summary>
- /// <param name="username"></param>
- public void TryRemove(string username) => Conversations.TryRemove(username, out _);
- }
-} \ No newline at end of file
diff --git a/src/slskd/Messaging/IConversationTracker.cs b/src/slskd/Messaging/IConversationTracker.cs
deleted file mode 100644
index 8e7a90f4..00000000
--- a/src/slskd/Messaging/IConversationTracker.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// <copyright file="IConversationTracker.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.Messaging
-{
- using System.Collections.Concurrent;
- using System.Collections.Generic;
-
- /// <summary>
- /// Tracks private message conversations.
- /// </summary>
- public interface IConversationTracker
- {
- /// <summary>
- /// Tracked private message conversations.
- /// </summary>
- ConcurrentDictionary<string, IList<PrivateMessage>> Conversations { get; }
-
- /// <summary>
- /// Adds a private message conversation and appends the specified <paramref name="message"/>, or just appends the
- /// message if the conversation exists.
- /// </summary>
- /// <param name="username"></param>
- /// <param name="message"></param>
- void AddOrUpdate(string username, PrivateMessage message);
-
- /// <summary>
- /// Returns the list of private messages for the specified <paramref name="username"/>, if any exist.
- /// </summary>
- /// <param name="username"></param>
- /// <param name="messages"></param>
- /// <returns></returns>
- bool TryGet(string username, out IList<PrivateMessage> messages);
-
- /// <summary>
- /// Removes a tracked private message conversation for the specified user.
- /// </summary>
- /// <param name="username"></param>
- void TryRemove(string username);
- }
-} \ No newline at end of file
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index f961c610..c909d7a4 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -544,7 +544,6 @@ namespace slskd
}
services.AddSingleton<IBrowseTracker, BrowseTracker>();
- services.AddSingleton<IConversationTracker, ConversationTracker>();
services.AddSingleton<IRoomTracker, RoomTracker>(_ => new RoomTracker(messageLimit: 250));
services.AddSingleton<IMessagingService, MessagingService>();