source: binary-improvements2/CommandExtensions/src/PrivateMessageConnections.cs@ 424

Last change on this file since 424 was 391, checked in by alloc, 2 years ago

Major refactoring/cleanup

File size: 753 bytes
Line 
1using System.Collections.Generic;
2
3namespace CommandExtensions {
4 public static class PrivateMessageConnections {
5 private static readonly Dictionary<PlatformUserIdentifierAbs, PlatformUserIdentifierAbs> senderOfLastPM = new Dictionary<PlatformUserIdentifierAbs, PlatformUserIdentifierAbs> ();
6
7 public static void SetLastPMSender (ClientInfo _sender, ClientInfo _receiver) {
8 senderOfLastPM [_receiver.InternalId] = _sender.InternalId;
9 }
10
11 public static ClientInfo GetLastPMSenderForPlayer (ClientInfo _player) {
12 if (!senderOfLastPM.TryGetValue (_player.InternalId, out PlatformUserIdentifierAbs recUserId)) {
13 return null;
14 }
15
16 ClientInfo recInfo = ConnectionManager.Instance.Clients.ForUserId (recUserId);
17 return recInfo;
18 }
19 }
20}
Note: See TracBrowser for help on using the repository browser.