diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-03 17:31:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-03 17:31:26 +0300 |
commit | b592850c224965729dfb68fcdce486346ab8301a (patch) | |
tree | c18fd7dd1fc92428c6452ac31af6fe864a10c8af | |
parent | cb6899fa0d8488e7e380179cb2d4bde763667d71 (diff) | |
download | plus-b592850c224965729dfb68fcdce486346ab8301a.tar.gz plus-b592850c224965729dfb68fcdce486346ab8301a.tar.bz2 plus-b592850c224965729dfb68fcdce486346ab8301a.tar.xz plus-b592850c224965729dfb68fcdce486346ab8301a.zip |
Add support for update server mirrors.
-rw-r--r-- | src/client.h | 3 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 7 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 4 | ||||
-rw-r--r-- | src/net/serverinfo.h | 4 |
4 files changed, 18 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h index 1cb35835a..2de069eb6 100644 --- a/src/client.h +++ b/src/client.h @@ -279,6 +279,9 @@ public: std::string getLogFileName() const A_WARN_UNUSED { return mLogFileName; } + const std::vector<std::string> &getMirrors() const A_WARN_UNUSED + { return mCurrentServer.updateMirrors; } + bool isKeyboardVisible() const; void setGuiAlpha(const float n) diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index c9695c2c1..653d62567 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -329,6 +329,7 @@ void ServerDialog::connectToSelectedServer() mServerInfo->supportUrl = server.supportUrl; mServerInfo->save = true; mServerInfo->persistentIp = server.persistentIp; + mServerInfo->updateMirrors = server.updateMirrors; if (chatLogger) chatLogger->setServerName(mServerInfo->hostname); @@ -637,6 +638,11 @@ void ServerDialog::loadServers(const bool addNew) subNode->xmlChildrenNode->content); server.persistentIp = (text == "1" || text == "true"); } + else if (xmlNameEqual(subNode, "updateMirror")) + { + server.updateMirrors.push_back(reinterpret_cast<const char*>( + subNode->xmlChildrenNode->content)); + } } server.version.first = font->getWidth(version); @@ -659,6 +665,7 @@ void ServerDialog::loadServers(const bool addNew) mServers[i].supportUrl = server.supportUrl; mServers[i].althostname = server.althostname; mServers[i].persistentIp = server.persistentIp; + mServers[i].updateMirrors = server.updateMirrors; mServersListModel->setVersionString(i, version); found = true; break; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 75460cf78..37bbabda3 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -540,6 +540,10 @@ void UpdaterWindow::download() "/").append(mCurrentFile), &updateProgress, false, false); } + const std::vector<std::string> &mirrors = client->getMirrors(); + FOR_EACH (std::vector<std::string>::const_iterator, it, mirrors) + mDownload->addMirror(*it); + if (mStoreInMemory) { mDownload->setWriteFunction(&UpdaterWindow::memoryWrite); diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index b2cd652bb..49497d736 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -53,6 +53,7 @@ public: std::string registerUrl; std::string onlineListUrl; std::string supportUrl; + std::vector<std::string> updateMirrors; uint16_t port; VersionString version; bool save; @@ -67,6 +68,7 @@ public: registerUrl(), onlineListUrl(), supportUrl(), + updateMirrors(), port(6901), version(), save(false), @@ -84,6 +86,7 @@ public: registerUrl(info.registerUrl), onlineListUrl(info.onlineListUrl), supportUrl(info.supportUrl), + updateMirrors(info.updateMirrors), port(info.port), version(), save(info.save), @@ -109,6 +112,7 @@ public: registerUrl.clear(); onlineListUrl.clear(); supportUrl.clear(); + updateMirrors.clear(); version.first = 0; version.second.clear(); save = false; |