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/lua_api/l_http.cpp | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/script/lua_api/l_http.cpp')
-rw-r--r-- | src/script/lua_api/l_http.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/script/lua_api/l_http.cpp b/src/script/lua_api/l_http.cpp index 21d000d25..84837e71b 100644 --- a/src/script/lua_api/l_http.cpp +++ b/src/script/lua_api/l_http.cpp @@ -30,9 +30,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <iomanip> #include <cctype> -#define HTTP_API(name) \ - lua_pushstring(L, #name); \ - lua_pushcfunction(L, l_http_##name); \ +#define HTTP_API(name) \ + lua_pushstring(L, #name); \ + lua_pushcfunction(L, l_http_##name); \ lua_settable(L, -3); #if USE_CURL @@ -54,8 +54,7 @@ void ModApiHttp::read_http_fetch_request(lua_State *L, HTTPFetchRequest &req) if (lua_istable(L, 2)) { lua_pushnil(L); while (lua_next(L, 2) != 0) { - req.post_fields[readParam<std::string>(L, -2)] = - readParam<std::string>(L, -1); + req.post_fields[readParam<std::string>(L, -2)] = readParam<std::string>(L, -1); lua_pop(L, 1); } } else if (lua_isstring(L, 2)) { @@ -74,8 +73,7 @@ void ModApiHttp::read_http_fetch_request(lua_State *L, HTTPFetchRequest &req) lua_pop(L, 1); } -void ModApiHttp::push_http_fetch_result( - lua_State *L, HTTPFetchResult &res, bool completed) +void ModApiHttp::push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool completed) { lua_newtable(L); setboolfield(L, -1, "succeeded", res.succeeded); @@ -173,19 +171,15 @@ int ModApiHttp::l_request_http_api(lua_State *L) std::string mod_name = readParam<std::string>(L, -1); std::string http_mods = g_settings->get("secure.http_mods"); - http_mods.erase(std::remove(http_mods.begin(), http_mods.end(), ' '), - http_mods.end()); + http_mods.erase(std::remove(http_mods.begin(), http_mods.end(), ' '), http_mods.end()); std::vector<std::string> mod_list_http = str_split(http_mods, ','); std::string trusted_mods = g_settings->get("secure.trusted_mods"); - trusted_mods.erase(std::remove(trusted_mods.begin(), trusted_mods.end(), ' '), - trusted_mods.end()); + trusted_mods.erase(std::remove(trusted_mods.begin(), trusted_mods.end(), ' '), trusted_mods.end()); std::vector<std::string> mod_list_trusted = str_split(trusted_mods, ','); - mod_list_http.insert(mod_list_http.end(), mod_list_trusted.begin(), - mod_list_trusted.end()); - if (std::find(mod_list_http.begin(), mod_list_http.end(), mod_name) == - mod_list_http.end()) { + mod_list_http.insert(mod_list_http.end(), mod_list_trusted.begin(), mod_list_trusted.end()); + if (std::find(mod_list_http.begin(), mod_list_http.end(), mod_name) == mod_list_http.end()) { lua_pushnil(L); return 1; } |