aboutsummaryrefslogtreecommitdiff
path: root/po
Commit message (Expand)AuthorAge
...
* Translated using Weblate (Italian)Michele Mainardi2017-05-04
* Translated using Weblate (Portuguese)Mário2017-05-04
* Translated using Weblate (Belarusian)Viktar Vauchkevich2017-05-04
* Translated using Weblate (Spanish)David Capello2017-05-04
* Translated using Weblate (Spanish)Laura Arjona Reina2017-05-04
* Added translation using Weblate (Swedish)metarmask2017-05-04
* Translated using Weblate (Japanese)BreadW2017-05-04
* Translated using Weblate (Japanese)monolifed2017-05-04
* Translated using Weblate (Russian)Andrey K2017-05-04
* Translated using Weblate (Turkish)monolifed2017-05-04
* Translated using Weblate (Malay)Muhammad Nur Hidayat Yasuyoshi2017-05-04
* Footsteps without view bobbing (#5645)Louis Pearson2017-04-25
* Translated using Weblate (Indonesian)fdedraco2017-04-06
* Translated using Weblate (Russian)Andrey K2017-04-06
* Translated using Weblate (Italian)i486DX22017-04-06
* Translated using Weblate (Portuguese (Brazil))Gabriel Carvalho2017-04-06
* Translated using Weblate (Turkish)monolifed2017-04-06
* Translated using Weblate (Korean)Han So Ri2017-04-06
* Translated using Weblate (Malay)Muhammad Nur Hidayat Yasuyoshi2017-04-06
* Translated using Weblate (Korean)Han So Ri2017-04-06
* Translated using Weblate (Chinese (China))黄冠恒2017-04-06
* Translated using Weblate (Malay)Muhammad Nur Hidayat Yasuyoshi2017-04-06
* Translated using Weblate (Serbian (cyrillic))lisacvuk2017-04-06
* Translated using Weblate (Chinese (China))susan2017-04-06
* Translated using Weblate (Polish)Jakub Mendel2017-04-06
* Translated using Weblate (Malay)Muhammad Nur Hidayat Yasuyoshi2017-04-06
* Translated using Weblate (Chinese (China))zaoqi2017-04-06
* Added translation using Weblate (Malay)Muhammad Nur Hidayat Yasuyoshi2017-04-06
* Translated using Weblate (Chinese (China))Guo Yunhe2017-04-06
* Translated using Weblate (Belarusian)Viktar Vauchkevich2017-04-06
* Translated using Weblate (Norwegian Bokmål)Petter Reinholdtsen2017-04-06
* Translated using Weblate (Belarusian)Viktar Vauchkevich2017-04-06
* Translated using Weblate (Belarusian)Viktar Vauchkevich2017-04-06
* Translated using Weblate (Polish)Andrzej Redlarski2017-04-06
* Translated using Weblate (Indonesian)Muhammad Rifqi Priyo Susanto2017-04-06
* Translated using Weblate (Lithuanian)ignaloidas2017-04-06
* Translated using Weblate (Portuguese (Brazil))Cold Meson 062017-04-06
* Translated using Weblate (Russian)Nikolay2016-12-22
* Translated using Weblate (Portuguese (Brazil))Cold Meson 062016-12-22
* Translated using Weblate (Portuguese (Brazil))Bruno Borges2016-12-22
* Translated using Weblate (Portuguese (Brazil))Cold Meson 062016-12-22
* Translated using Weblate (Dutch)Rogier2016-12-22
* Translated using Weblate (German)Wuzzy2016-12-22
* Correct Swahili translations (#4939)sfan52016-12-21
* Fix build with gettext enabledest312016-12-14
* Run updatepo.shest312016-12-14
* Translated using Weblate (Ukrainian)Fixer2016-12-14
* Translated using Weblate (German)Wuzzy2016-12-14
* Translated using Weblate (German)Jan Sbrz2016-12-14
* Translated using Weblate (Lithuanian)Zygi Mantus2016-12-14
span> void ScriptApiServer::getAuthHandler() { lua_State *L = getStack(); lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_auth_handler"); if (lua_isnil(L, -1)){ lua_pop(L, 1); lua_getfield(L, -1, "builtin_auth_handler"); } setOriginFromTable(-1); lua_remove(L, -2); // Remove core if (lua_type(L, -1) != LUA_TTABLE) throw LuaError("Authentication handler table not valid"); } void ScriptApiServer::readPrivileges(int index, std::set<std::string> &result) { lua_State *L = getStack(); result.clear(); lua_pushnil(L); if (index < 0) index -= 1; while (lua_next(L, index) != 0) { // key at index -2 and value at index -1 std::string key = luaL_checkstring(L, -2); bool value = readParam<bool>(L, -1); if (value) result.insert(key); // removes value, keeps key for next iteration lua_pop(L, 1); } } void ScriptApiServer::createAuth(const std::string &playername, const std::string &password) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); getAuthHandler(); lua_getfield(L, -1, "create_auth"); lua_remove(L, -2); // Remove auth handler if (lua_type(L, -1) != LUA_TFUNCTION) throw LuaError("Authentication handler missing create_auth"); lua_pushstring(L, playername.c_str()); lua_pushstring(L, password.c_str()); PCALL_RES(lua_pcall(L, 2, 0, error_handler)); lua_pop(L, 1); // Pop error handler } bool ScriptApiServer::setPassword(const std::string &playername, const std::string &password) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); getAuthHandler(); lua_getfield(L, -1, "set_password"); lua_remove(L, -2); // Remove auth handler if (lua_type(L, -1) != LUA_TFUNCTION) throw LuaError("Authentication handler missing set_password"); lua_pushstring(L, playername.c_str()); lua_pushstring(L, password.c_str()); PCALL_RES(lua_pcall(L, 2, 1, error_handler)); lua_remove(L, error_handler); return lua_toboolean(L, -1); } bool ScriptApiServer::on_chat_message(const std::string &name, const std::string &message) { SCRIPTAPI_PRECHECKHEADER // Get core.registered_on_chat_messages lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_chat_messages"); // Call callbacks lua_pushstring(L, name.c_str()); lua_pushstring(L, message.c_str()); runCallbacks(2, RUN_CALLBACKS_MODE_OR_SC); return readParam<bool>(L, -1); } void ScriptApiServer::on_mods_loaded() { SCRIPTAPI_PRECHECKHEADER // Get registered shutdown hooks lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_mods_loaded"); // Call callbacks runCallbacks(0, RUN_CALLBACKS_MODE_FIRST); } void ScriptApiServer::on_shutdown() { SCRIPTAPI_PRECHECKHEADER // Get registered shutdown hooks lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_on_shutdown"); // Call callbacks runCallbacks(0, RUN_CALLBACKS_MODE_FIRST); } std::string ScriptApiServer::formatChatMessage(const std::string &name, const std::string &message) { SCRIPTAPI_PRECHECKHEADER // Push function onto stack lua_getglobal(L, "core"); lua_getfield(L, -1, "format_chat_message"); // Push arguments onto stack lua_pushstring(L, name.c_str()); lua_pushstring(L, message.c_str()); // Actually call the function lua_call(L, 2, 1); // Fetch return value std::string ret = lua_tostring(L, -1); lua_pop(L, 1); return ret; }