From 2f47dbf5d7245220b935e58f4a513902547675b0 Mon Sep 17 00:00:00 2001 From: in0finite Date: Sat, 20 Feb 2021 21:57:52 +0100 Subject: [PATCH] trim chat messages --- Assets/Scripts/Chat/ChatManager.cs | 2 ++ Assets/Scripts/Chat/ChatSync.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Assets/Scripts/Chat/ChatManager.cs b/Assets/Scripts/Chat/ChatManager.cs index f48fe2a8..9b1b8a93 100644 --- a/Assets/Scripts/Chat/ChatManager.cs +++ b/Assets/Scripts/Chat/ChatManager.cs @@ -105,6 +105,8 @@ namespace SanAndreasUnity.Chat if (!NetStatus.IsServerStarted) return; + msg = msg.Trim(); + foreach (var player in Player.AllPlayers) { SendChatMessageToPlayer ( player, msg, sender ); } diff --git a/Assets/Scripts/Chat/ChatSync.cs b/Assets/Scripts/Chat/ChatSync.cs index d5aaaee9..9b2fe3a7 100644 --- a/Assets/Scripts/Chat/ChatSync.cs +++ b/Assets/Scripts/Chat/ChatSync.cs @@ -25,6 +25,7 @@ namespace SanAndreasUnity.Chat Player p = m_player; + msg = msg.Trim(); // Remove tags. msg = msg.Replace ("<", ""); // the only easy way :D @@ -51,6 +52,8 @@ namespace SanAndreasUnity.Chat return; } + msg = msg.Trim(); + onChatMessageReceivedOnLocalPlayer (new ChatMessage (msg, sender)); }