aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorproller <proller@github.com>2013-03-30 02:03:24 +0400
committerproller <proller@github.com>2013-03-30 02:03:24 +0400
commit16c11eb4a3bb46a388c645b7db738762e444cde8 (patch)
tree684795401e8837f03b3b6f7573c861cc8de6aac8 /src
parentdf49b93877b40551111be6ef5ecfe4629787ab75 (diff)
downloadminetest-16c11eb4a3bb46a388c645b7db738762e444cde8.tar.gz
minetest-16c11eb4a3bb46a388c645b7db738762e444cde8.tar.bz2
minetest-16c11eb4a3bb46a388c645b7db738762e444cde8.zip
Masterserver: report gameid, uptime, cosmetic fixes on server web page
Diffstat (limited to 'src')
-rw-r--r--src/server.cpp2
-rw-r--r--src/serverlist.cpp5
-rw-r--r--src/serverlist.h2
3 files changed, 6 insertions, 3 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 6bdebcec4..c4dd0ab0f 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1243,7 +1243,7 @@ void Server::AsyncRunStep()
float &counter = m_masterserver_timer;
if((!counter || counter >= 300.0) && g_settings->getBool("server_announce") == true)
{
- ServerList::sendAnnounce(!counter ? "start" : "update", m_clients_number);
+ ServerList::sendAnnounce(!counter ? "start" : "update", m_clients_number, m_uptime.get(), m_gamespec.id);
counter = 0.01;
}
counter += dtime;
diff --git a/src/serverlist.cpp b/src/serverlist.cpp
index 3dfc79f50..93f9d2435 100644
--- a/src/serverlist.cpp
+++ b/src/serverlist.cpp
@@ -232,7 +232,7 @@ static size_t ServerAnnounceCallback(void *contents, size_t size, size_t nmemb,
//((std::string*)userp)->append((char*)contents, size * nmemb);
//return size * nmemb;
}
-void sendAnnounce(std::string action, u16 clients) {
+void sendAnnounce(std::string action, u16 clients, double uptime, std::string gameid) {
Json::Value server;
if (action.size())
server["action"] = action;
@@ -250,6 +250,9 @@ void sendAnnounce(std::string action, u16 clients) {
server["pvp"] = g_settings->getBool("enable_pvp");
server["clients"] = clients;
server["clients_max"] = g_settings->get("max_users");
+ if (uptime >=1) server["uptime"] = (int)uptime;
+ if (gameid!="") server["gameid"] = gameid;
+
}
if(server["action"] == "start")
actionstream << "announcing to " << g_settings->get("serverlist_url") << std::endl;
diff --git a/src/serverlist.h b/src/serverlist.h
index e81e64c5b..d01415c50 100644
--- a/src/serverlist.h
+++ b/src/serverlist.h
@@ -39,7 +39,7 @@ namespace ServerList
std::vector<ServerListSpec> deSerializeJson(std::string liststring);
std::string serializeJson(std::vector<ServerListSpec>);
#if USE_CURL
- void sendAnnounce(std::string action = "", u16 clients = 0);
+ void sendAnnounce(std::string action = "", u16 clients = 0, double uptime = 0, std::string gameid = "");
#endif
} //ServerList namespace