iw4x-client/src/Components/Modules/News.cpp
2016-01-27 00:50:20 +01:00

36 lines
742 B
C++

#include "STDInclude.hpp"
namespace Components
{
std::thread* News::Thread = 0;
News::News()
{
Localization::Set("MPUI_CHANGELOG_TEXT", "");
Localization::Set("MPUI_MOTD_TEXT", "Welcome to ReactIW4x Multiplayer!");
News::Thread = new std::thread([] ()
{
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").Get().data());
std::string data = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").Get();
if (data.size())
{
Localization::Set("MPUI_MOTD_TEXT", data.data());
}
// TODO: Implement update checks here!
});
}
News::~News()
{
if (News::Thread)
{
News::Thread->join();
delete News::Thread;
}
}
}