summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_client.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2018-12-24 10:51:10 +0100
committerGitHub <noreply@github.com>2018-12-24 10:51:10 +0100
commita5197eaebc61ac6b555a640f36c0b427faef381d (patch)
tree48b4deb787731aba6b2c7f50e3664420cdbe94db /src/script/lua_api/l_client.cpp
parent9080d7c990e9efd52c418369c83dd365837f2f05 (diff)
downloadminetest-a5197eaebc61ac6b555a640f36c0b427faef381d.tar.gz
minetest-a5197eaebc61ac6b555a640f36c0b427faef381d.tar.bz2
minetest-a5197eaebc61ac6b555a640f36c0b427faef381d.zip
CSM: add requested CSM_RF_READ_PLAYERINFO (#8007)
* CSM: add requested CSM_RF_READ_PLAYERINFO This new CSM limit permit to limit PLAYERINFO read from server. It affects get_player_names call
Diffstat (limited to 'src/script/lua_api/l_client.cpp')
-rw-r--r--src/script/lua_api/l_client.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 8a5867a32..6d9d832b7 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -116,6 +116,13 @@ int ModApiClient::l_clear_out_chat_queue(lua_State *L)
// get_player_names()
int ModApiClient::l_get_player_names(lua_State *L)
{
+ // clang-format off
+ if (getClient(L)->checkCSMRestrictionFlag(
+ CSMRestrictionFlags::CSM_RF_READ_PLAYERINFO)) {
+ return 0;
+ }
+ // clang-format on
+
const std::list<std::string> &plist = getClient(L)->getConnectedPlayerNames();
lua_createtable(L, plist.size(), 0);
int newTable = lua_gettop(L);