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