2016-01-04 14:58:00 -05:00
|
|
|
#include "STDInclude.hpp"
|
2015-12-30 18:55:08 -05:00
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
2016-01-26 18:50:20 -05:00
|
|
|
std::thread* News::Thread = 0;
|
2015-12-30 18:55:08 -05:00
|
|
|
|
|
|
|
News::News()
|
|
|
|
{
|
2016-01-11 18:48:27 -05:00
|
|
|
Localization::Set("MPUI_CHANGELOG_TEXT", "");
|
2016-01-26 18:50:20 -05:00
|
|
|
Localization::Set("MPUI_MOTD_TEXT", "Welcome to ReactIW4x Multiplayer!");
|
2016-01-11 18:48:27 -05:00
|
|
|
|
2016-01-26 18:50:20 -05:00
|
|
|
News::Thread = new std::thread([] ()
|
2015-12-30 18:55:08 -05:00
|
|
|
{
|
2016-01-26 18:50:20 -05:00
|
|
|
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();
|
2015-12-30 18:55:08 -05:00
|
|
|
|
2016-01-26 18:50:20 -05:00
|
|
|
if (data.size())
|
|
|
|
{
|
|
|
|
Localization::Set("MPUI_MOTD_TEXT", data.data());
|
|
|
|
}
|
2016-01-07 18:59:59 -05:00
|
|
|
|
2016-01-26 18:50:20 -05:00
|
|
|
// TODO: Implement update checks here!
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
News::~News()
|
|
|
|
{
|
|
|
|
if (News::Thread)
|
|
|
|
{
|
|
|
|
News::Thread->join();
|
|
|
|
delete News::Thread;
|
|
|
|
}
|
2015-12-30 18:55:08 -05:00
|
|
|
}
|
|
|
|
}
|