From dc3ca09e0e0e25f40cccae12c73830b0334ffb60 Mon Sep 17 00:00:00 2001 From: Elijah Duffy Date: Fri, 14 Jul 2017 11:37:58 -0700 Subject: Remove remaining modstore code (#6120) --- src/script/lua_api/l_mainmenu.cpp | 145 -------------------------------------- src/script/lua_api/l_mainmenu.h | 4 -- 2 files changed, 149 deletions(-) (limited to 'src/script') diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 917fea134..b0ce6b740 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -310,147 +310,6 @@ int ModApiMainMenu::l_get_games(lua_State *L) } return 1; } -/******************************************************************************/ -int ModApiMainMenu::l_get_modstore_details(lua_State *L) -{ - const char *modid = luaL_checkstring(L, 1); - - if (modid != 0) { - Json::Value details; - std::string url = ""; - try{ - url = g_settings->get("modstore_details_url"); - } - catch(SettingNotFoundException &e) { - lua_pushnil(L); - return 1; - } - - size_t idpos = url.find("*"); - url.erase(idpos,1); - url.insert(idpos,modid); - - details = getModstoreUrl(url); - - ModStoreModDetails current_mod = readModStoreModDetails(details); - - if ( current_mod.valid) { - lua_newtable(L); - int top = lua_gettop(L); - - lua_pushstring(L,"id"); - lua_pushnumber(L,current_mod.id); - lua_settable(L, top); - - lua_pushstring(L,"title"); - lua_pushstring(L,current_mod.title.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"basename"); - lua_pushstring(L,current_mod.basename.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"description"); - lua_pushstring(L,current_mod.description.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"author"); - lua_pushstring(L,current_mod.author.username.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"download_url"); - lua_pushstring(L,current_mod.versions[0].file.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"versions"); - lua_newtable(L); - int versionstop = lua_gettop(L); - for (unsigned int i=0;i < current_mod.versions.size(); i++) { - lua_pushnumber(L,i+1); - lua_newtable(L); - int current_element = lua_gettop(L); - - lua_pushstring(L,"date"); - lua_pushstring(L,current_mod.versions[i].date.c_str()); - lua_settable(L,current_element); - - lua_pushstring(L,"download_url"); - lua_pushstring(L,current_mod.versions[i].file.c_str()); - lua_settable(L,current_element); - - lua_settable(L,versionstop); - } - lua_settable(L, top); - - lua_pushstring(L,"screenshot_url"); - lua_pushstring(L,current_mod.titlepic.file.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"license"); - lua_pushstring(L,current_mod.license.shortinfo.c_str()); - lua_settable(L, top); - - lua_pushstring(L,"rating"); - lua_pushnumber(L,current_mod.rating); - lua_settable(L, top); - - //TODO depends - - //TODO softdepends - return 1; - } - } - return 0; -} - -/******************************************************************************/ -int ModApiMainMenu::l_get_modstore_list(lua_State *L) -{ - Json::Value mods; - std::string url = ""; - try{ - url = g_settings->get("modstore_listmods_url"); - } - catch(SettingNotFoundException &e) { - lua_pushnil(L); - return 1; - } - - mods = getModstoreUrl(url); - - std::vector moddata = readModStoreList(mods); - - lua_newtable(L); - int top = lua_gettop(L); - unsigned int index = 1; - - for (unsigned int i = 0; i < moddata.size(); i++) - { - if (moddata[i].valid) { - lua_pushnumber(L,index); - lua_newtable(L); - - int top_lvl2 = lua_gettop(L); - - lua_pushstring(L,"id"); - lua_pushnumber(L,moddata[i].id); - lua_settable(L, top_lvl2); - - lua_pushstring(L,"title"); - lua_pushstring(L,moddata[i].title.c_str()); - lua_settable(L, top_lvl2); - - lua_pushstring(L,"basename"); - lua_pushstring(L,moddata[i].basename.c_str()); - lua_settable(L, top_lvl2); - - lua_settable(L, top); - index++; - } - } - return 1; -} - /******************************************************************************/ int ModApiMainMenu::l_get_favorites(lua_State *L) { @@ -1137,8 +996,6 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(get_mainmenu_path); API_FCT(show_path_select_dialog); API_FCT(download_file); - API_FCT(get_modstore_details); - API_FCT(get_modstore_list); API_FCT(gettext); API_FCT(get_video_drivers); API_FCT(get_video_modes); @@ -1166,7 +1023,5 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top) API_FCT(copy_dir); //API_FCT(extract_zip); //TODO remove dependency to GuiEngine API_FCT(download_file); - API_FCT(get_modstore_details); - API_FCT(get_modstore_list); //API_FCT(gettext); (gettext lib isn't threadsafe) } diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index 1d3e931e1..4be07576c 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -124,10 +124,6 @@ private: static int l_extract_zip(lua_State *L); - static int l_get_modstore_details(lua_State *L); - - static int l_get_modstore_list(lua_State *L); - static int l_download_file(lua_State *L); static int l_get_video_drivers(lua_State *L); -- cgit v1.2.3