Remove a lot of superfluous ifndef USE_CURL checks

master
sapier 2014-04-06 14:02:53 +02:00
parent 99f565e8f2
commit 9a39848ba9
4 changed files with 7 additions and 17 deletions

View File

@ -33,18 +33,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Json::Value fetchJsonValue(const std::string &url, Json::Value fetchJsonValue(const std::string &url,
struct curl_slist *chunk) { struct curl_slist *chunk) {
#if USE_CURL
HTTPFetchRequest fetchrequest; HTTPFetchRequest fetchrequest;
HTTPFetchResult fetchresult; HTTPFetchResult fetchresult;
fetchrequest.url = url; fetchrequest.url = url;
fetchrequest.caller = HTTPFETCH_SYNC; fetchrequest.caller = HTTPFETCH_SYNC;
#if USE_CURL
struct curl_slist* runptr = chunk; struct curl_slist* runptr = chunk;
while(runptr) { while(runptr) {
fetchrequest.extra_headers.push_back(runptr->data); fetchrequest.extra_headers.push_back(runptr->data);
runptr = runptr->next; runptr = runptr->next;
} }
#endif
httpfetch_sync(fetchrequest,fetchresult); httpfetch_sync(fetchrequest,fetchresult);
if (!fetchresult.succeeded) { if (!fetchresult.succeeded) {
@ -71,7 +72,7 @@ Json::Value fetchJsonValue(const std::string &url,
else { else {
return root; return root;
} }
#endif
return Json::Value(); return Json::Value();
} }

View File

@ -456,15 +456,12 @@ int ModApiMainMenu::l_get_favorites(lua_State *L)
} }
std::vector<ServerListSpec> servers; std::vector<ServerListSpec> servers;
#if USE_CURL
if(listtype == "online") { if(listtype == "online") {
servers = ServerList::getOnline(); servers = ServerList::getOnline();
} else { } else {
servers = ServerList::getLocal(); servers = ServerList::getLocal();
} }
#else
servers = ServerList::getLocal();
#endif
lua_newtable(L); lua_newtable(L);
int top = lua_gettop(L); int top = lua_gettop(L);
@ -582,15 +579,12 @@ int ModApiMainMenu::l_delete_favorite(lua_State *L)
(listtype != "online")) (listtype != "online"))
return 0; return 0;
#if USE_CURL
if(listtype == "online") { if(listtype == "online") {
servers = ServerList::getOnline(); servers = ServerList::getOnline();
} else { } else {
servers = ServerList::getLocal(); servers = ServerList::getLocal();
} }
#else
servers = ServerList::getLocal();
#endif
int fav_idx = luaL_checkinteger(L,1) -1; int fav_idx = luaL_checkinteger(L,1) -1;

View File

@ -68,7 +68,6 @@ std::vector<ServerListSpec> getLocal()
} }
#if USE_CURL
std::vector<ServerListSpec> getOnline() std::vector<ServerListSpec> getOnline()
{ {
Json::Value root = fetchJsonValue((g_settings->get("serverlist_url")+"/list").c_str(),0); Json::Value root = fetchJsonValue((g_settings->get("serverlist_url")+"/list").c_str(),0);
@ -87,8 +86,6 @@ std::vector<ServerListSpec> getOnline()
return serverlist; return serverlist;
} }
#endif
/* /*
Delete a server fromt he local favorites list Delete a server fromt he local favorites list
*/ */

View File

@ -30,9 +30,7 @@ typedef Json::Value ServerListSpec;
namespace ServerList namespace ServerList
{ {
std::vector<ServerListSpec> getLocal(); std::vector<ServerListSpec> getLocal();
#if USE_CURL
std::vector<ServerListSpec> getOnline(); std::vector<ServerListSpec> getOnline();
#endif
bool deleteEntry(ServerListSpec server); bool deleteEntry(ServerListSpec server);
bool insert(ServerListSpec server); bool insert(ServerListSpec server);
std::vector<ServerListSpec> deSerialize(std::string liststring); std::vector<ServerListSpec> deSerialize(std::string liststring);