mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Only allow players with shout to chat
Fix regression of commit
5e507c9829
"Add server side ncurses terminal"
which allowed all players, even those without a shout priv, to chat.
Fixes #3362.
This commit is contained in:
parent
36855522a5
commit
657a16d90c
3 changed files with 14 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue