source: TFP-WebServer/CommandExtensions/src/ChatHelpers.cs@ 500

Last change on this file since 500 was 499, checked in by alloc, 4 months ago

*Fixed: Chat code
*Fixed: SSE connection counting, added connection set up logging

File size: 772 bytes
RevLine 
[391]1namespace CommandExtensions {
2 public static class ChatHelpers {
3 public static void SendMessage (ClientInfo _receiver, ClientInfo _sender, string _message) {
4 string senderName;
5 if (_sender != null) {
6 PrivateMessageConnections.SetLastPMSender (_sender, _receiver);
7 senderName = _sender.playerName;
8 } else {
9 senderName = "Server";
10 }
11
[499]12 _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1,
13 $"{senderName} (PM): {_message}", null,
14 EMessageSender.None));
[391]15 string receiverName = _receiver.playerName;
[402]16 receiverName = receiverName != null ? $"\"{receiverName}\"" : "unknownName";
17 SdtdConsole.Instance.Output ($"Message to player {receiverName} sent with sender \"{senderName}\"");
[391]18 }
19 }
20}
Note: See TracBrowser for help on using the repository browser.