Remove a lot of superfluous ifndef USE_CURL checks 1392/head
authorsapier <Sapier at GMX dot net>
Sun, 6 Apr 2014 12:02:53 +0000 (14:02 +0200)
committersapier <Sapier at GMX dot net>
Thu, 19 Jun 2014 17:05:37 +0000 (19:05 +0200)
src/convert_json.cpp
src/script/lua_api/l_mainmenu.cpp
src/serverlist.cpp
src/serverlist.h

index 6f227e7967501818789185036e7082403d81b016..a6107aa64a7fec1790e9d133c9fabb6c95a2178b 100644 (file)
@@ -32,19 +32,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "porting.h"
 
 Json::Value                 fetchJsonValue(const std::string &url,
-                                           struct curl_slist *chunk) {
-#if USE_CURL
+               struct curl_slist *chunk) {
 
        HTTPFetchRequest fetchrequest;
        HTTPFetchResult fetchresult;
        fetchrequest.url = url;
        fetchrequest.caller = HTTPFETCH_SYNC;
 
+#if USE_CURL
        struct curl_slist* runptr = chunk;
        while(runptr) {
                fetchrequest.extra_headers.push_back(runptr->data);
                runptr = runptr->next;
        }
+#endif
        httpfetch_sync(fetchrequest,fetchresult);
 
        if (!fetchresult.succeeded) {
@@ -71,12 +72,12 @@ Json::Value                 fetchJsonValue(const std::string &url,
        else {
                return root;
        }
-#endif
+
        return Json::Value();
 }
 
 std::vector<ModStoreMod>    readModStoreList(Json::Value& modlist) {
-       std::vector<ModStoreMod> retval;
+               std::vector<ModStoreMod> retval;
 
        if (modlist.isArray()) {
                for (unsigned int i = 0; i < modlist.size(); i++)
index f2628d0a10bbe946b52d4117bd075ac538e01df7..cb32c9e82e970a672989a255bb043c0e5c5d6763 100644 (file)
@@ -456,15 +456,12 @@ int ModApiMainMenu::l_get_favorites(lua_State *L)
        }
 
        std::vector<ServerListSpec> servers;
-#if USE_CURL
+
        if(listtype == "online") {
                servers = ServerList::getOnline();
        } else {
                servers = ServerList::getLocal();
        }
-#else
-       servers = ServerList::getLocal();
-#endif
 
        lua_newtable(L);
        int top = lua_gettop(L);
@@ -582,15 +579,12 @@ int ModApiMainMenu::l_delete_favorite(lua_State *L)
                (listtype != "online"))
                return 0;
 
-#if USE_CURL
+
        if(listtype == "online") {
                servers = ServerList::getOnline();
        } else {
                servers = ServerList::getLocal();
        }
-#else
-       servers = ServerList::getLocal();
-#endif
 
        int fav_idx     = luaL_checkinteger(L,1) -1;
 
index 10ec5771f0d045e3a119a32b71c8e60a7275b2db..00b5f2deeb1d0ee7e4025287beadc13e0eb16f18 100644 (file)
@@ -68,7 +68,6 @@ std::vector<ServerListSpec> getLocal()
 }
 
 
-#if USE_CURL
 std::vector<ServerListSpec> getOnline()
 {
        Json::Value root = fetchJsonValue((g_settings->get("serverlist_url")+"/list").c_str(),0);
@@ -87,8 +86,6 @@ std::vector<ServerListSpec> getOnline()
        return serverlist;
 }
 
-#endif
-
 /*
        Delete a server fromt he local favorites list
 */
index 915e8482f039fe5d8ded0df33657ed12900b5d7f..bc40a1b3952c76c5b9e1e79f9f081e2271412a5a 100644 (file)
@@ -30,9 +30,7 @@ typedef Json::Value ServerListSpec;
 namespace ServerList
 {
        std::vector<ServerListSpec> getLocal();
-       #if USE_CURL
        std::vector<ServerListSpec> getOnline();
-       #endif
        bool deleteEntry(ServerListSpec server);
        bool insert(ServerListSpec server);
        std::vector<ServerListSpec> deSerialize(std::string liststring);