diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/script/cpp_api/s_server.cpp | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/script/cpp_api/s_server.cpp')
-rw-r--r-- | src/script/cpp_api/s_server.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/script/cpp_api/s_server.cpp b/src/script/cpp_api/s_server.cpp index 1cb3f99f1..96cb28b28 100644 --- a/src/script/cpp_api/s_server.cpp +++ b/src/script/cpp_api/s_server.cpp @@ -21,8 +21,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_internal.h" #include "common/c_converter.h" -bool ScriptApiServer::getAuth(const std::string &playername, std::string *dst_password, - std::set<std::string> *dst_privs, s64 *dst_last_login) +bool ScriptApiServer::getAuth(const std::string &playername, + std::string *dst_password, + std::set<std::string> *dst_privs, + s64 *dst_last_login) { SCRIPTAPI_PRECHECKHEADER @@ -52,10 +54,10 @@ bool ScriptApiServer::getAuth(const std::string &playername, std::string *dst_pa throw LuaError("Authentication handler didn't return privilege table"); if (dst_privs) readPrivileges(-1, *dst_privs); - lua_pop(L, 1); // Remove key from privs table + lua_pop(L, 1); // Remove key from privs table s64 last_login; - if (!getintfield(L, -1, "last_login", last_login)) + if(!getintfield(L, -1, "last_login", last_login)) throw LuaError("Authentication handler didn't return last_login"); if (dst_last_login) *dst_last_login = (s64)last_login; @@ -69,7 +71,7 @@ void ScriptApiServer::getAuthHandler() lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_auth_handler"); - if (lua_isnil(L, -1)) { + if (lua_isnil(L, -1)){ lua_pop(L, 1); lua_getfield(L, -1, "builtin_auth_handler"); } @@ -100,8 +102,8 @@ void ScriptApiServer::readPrivileges(int index, std::set<std::string> &result) } } -void ScriptApiServer::createAuth( - const std::string &playername, const std::string &password) +void ScriptApiServer::createAuth(const std::string &playername, + const std::string &password) { SCRIPTAPI_PRECHECKHEADER @@ -117,8 +119,8 @@ void ScriptApiServer::createAuth( lua_pop(L, 1); // Pop error handler } -bool ScriptApiServer::setPassword( - const std::string &playername, const std::string &password) +bool ScriptApiServer::setPassword(const std::string &playername, + const std::string &password) { SCRIPTAPI_PRECHECKHEADER @@ -135,7 +137,8 @@ bool ScriptApiServer::setPassword( return lua_toboolean(L, -1); } -bool ScriptApiServer::on_chat_message(const std::string &name, const std::string &message) +bool ScriptApiServer::on_chat_message(const std::string &name, + const std::string &message) { SCRIPTAPI_PRECHECKHEADER @@ -171,8 +174,8 @@ void ScriptApiServer::on_shutdown() runCallbacks(0, RUN_CALLBACKS_MODE_FIRST); } -std::string ScriptApiServer::formatChatMessage( - const std::string &name, const std::string &message) +std::string ScriptApiServer::formatChatMessage(const std::string &name, + const std::string &message) { SCRIPTAPI_PRECHECKHEADER |