From 21823c3f5821ee18208a73555d96356ce0c0efc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 24 May 2010 13:52:45 +0200 Subject: [PATCH] game: Replace newlines by space when printing the chat messages. --- src/egs_game.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/egs_game.erl b/src/egs_game.erl index 2c88ba0..a7dc90f 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -393,7 +393,8 @@ handle(16#0304, _, GID, Version, Packet) -> ActualName = ChatName end, [LogName|_] = re:split(ActualName, "\\0\\0", [{return, binary}]), - [LogMessage|_] = re:split(ChatMessage, "\\0\\0", [{return, binary}]), + [TmpMessage|_] = re:split(ChatMessage, "\\0\\0", [{return, binary}]), + LogMessage = re:replace(TmpMessage, "\\n", " ", [global, {return, binary}]), log(GID, io_lib:format("chat from ~s: ~s", [[re:replace(LogName, "\\0", "", [global, {return, binary}])], [re:replace(LogMessage, "\\0", "", [global, {return, binary}])]])), lists:foreach(fun(User) -> User#users.pid ! {psu_chat, GID, ActualName, ChatModifiers, ChatMessage} end, egs_db:users_select_all());