From 657a16d90c42afc212e70c594296b1e204545a4c Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 13 Nov 2015 01:35:54 +0100 Subject: Only allow players with shout to chat Fix regression of commit 5e507c9829942c434a6f1ae7a4f3a488c7e50bef "Add server side ncurses terminal" which allowed all players, even those without a shout priv, to chat. Fixes #3362. --- src/server.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index c93abb10c..f6faccb1f 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2755,7 +2755,8 @@ void Server::handleChatInterfaceEvent(ChatEvent *evt) } std::wstring Server::handleChat(const std::string &name, const std::wstring &wname, - const std::wstring &wmessage, u16 peer_id_to_avoid_sending) + const std::wstring &wmessage, bool check_shout_priv, + u16 peer_id_to_avoid_sending) { // If something goes wrong, this player is to blame RollbackScopeActor rollback_scope(m_rollback, @@ -2783,10 +2784,15 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna else line += L"-!- Invalid command: " + str_split(wcmd, L' ')[0]; } else { - line += L"<"; - line += wname; - line += L"> "; - line += wmessage; + if (check_shout_priv && !checkPriv(name, "shout")) { + line += L"-!- You don't have permission to shout."; + broadcast_line = false; + } else { + line += L"<"; + line += wname; + line += L"> "; + line += wmessage; + } } /* -- cgit v1.2.3