If a recipient can't be found for a private message sent by a client, the server sends the "player not found" error message to the client

This commit is contained in:
Regalis
2017-04-17 19:48:29 +03:00
parent 7df4bff249
commit e4a7d31f78
@@ -1451,8 +1451,25 @@ namespace Barotrauma.Networking
(c.Character != null && command == c.Character.Name.ToLowerInvariant())); (c.Character != null && command == c.Character.Name.ToLowerInvariant()));
if (targetClient == null) if (targetClient == null)
{
if (senderClient != null)
{
var chatMsg = ChatMessage.Create(
"", "Player \"" + command + "\" not found!",
ChatMessageType.Error, null);
chatMsg.NetStateID = senderClient.chatMsgQueue.Count > 0 ?
(ushort)(senderClient.chatMsgQueue.Last().NetStateID + 1) :
(ushort)(senderClient.lastRecvChatMsgID + 1);
senderClient.chatMsgQueue.Add(chatMsg);
senderClient.lastChatMsgQueueID = chatMsg.NetStateID;
}
else
{ {
AddChatMessage("Player \"" + command + "\" not found!", ChatMessageType.Error); AddChatMessage("Player \"" + command + "\" not found!", ChatMessageType.Error);
}
return; return;
} }
} }