summaryrefslogtreecommitdiff
path: root/src/gui/serverdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-17 21:31:08 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-17 21:31:08 +0300
commit4cd44430deb5a7efc030839a133fe8510327fc24 (patch)
tree79558ea0608257be85840cfb8289c20080fdc70b /src/gui/serverdialog.cpp
parent2e84ac20fcf6ec69b40e19c4c6c428db04b70d85 (diff)
downloadmanaplus-4cd44430deb5a7efc030839a133fe8510327fc24.tar.gz
manaplus-4cd44430deb5a7efc030839a133fe8510327fc24.tar.bz2
manaplus-4cd44430deb5a7efc030839a133fe8510327fc24.tar.xz
manaplus-4cd44430deb5a7efc030839a133fe8510327fc24.zip
Update servers list once a day.
Diffstat (limited to 'src/gui/serverdialog.cpp')
-rw-r--r--src/gui/serverdialog.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 55eda908e..da61e105b 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -305,7 +305,7 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
loadServers(true);
- if (mServers.empty())
+ if (needUpdateServers())
downloadServerList();
}
@@ -487,6 +487,8 @@ void ServerDialog::downloadServerList()
mDownload->setFile(mDir + "/" + branding.getStringValue(
"onlineServerFile"));
mDownload->start();
+
+ config.setValue("serverslistupdate", getDateString());
}
void ServerDialog::loadServers(bool addNew)
@@ -742,3 +744,14 @@ void ServerDialog::updateServer(ServerInfo server, int index)
{
saveCustomServers(server, index);
}
+
+bool ServerDialog::needUpdateServers()
+{
+ if (mServers.empty() || config.getStringValue("serverslistupdate")
+ != getDateString())
+ {
+ return true;
+ }
+
+ return false;
+}