mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Persist the lobby Terms Of Use and Terms Of Service checkbox if the logged in user and the accepted versions of the pages didn't change since last login, refs #5218.
This way the user is only forced to read the Terms again that changed or if the user logged in from a different machine. Use md5sum since it is sufficiently resistant against collisions and doesn't freeze the window for 2 seconds like EncryptPassword / SHA256 does, refs #4399. Use 0 instead of empty string in default.cfg, refs #3990. Differential Revision: https://code.wildfiregames.com/D1575 Partial review by: Vladislav This was SVN commit r21850.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "graphics/MapReader.h"
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
#include "lib/utf8.h"
|
||||
#include "maths/MD5.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/GUID.h"
|
||||
#include "ps/GameSetup/Atlas.h"
|
||||
@@ -109,6 +110,21 @@ int JSI_Main::GetTextWidth(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const
|
||||
return width;
|
||||
}
|
||||
|
||||
std::string JSI_Main::CalculateMD5(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& input)
|
||||
{
|
||||
u8 digest[MD5::DIGESTSIZE];
|
||||
|
||||
MD5 m;
|
||||
m.Update(static_cast<const u8*>(input.c_str()), input.length());
|
||||
m.Final(digest);
|
||||
|
||||
char digeststr[MD5::DIGESTSIZE*2+1];
|
||||
for (size_t i = 0; i < MD5::DIGESTSIZE; ++i)
|
||||
sprintf_s(digeststr+2*i, 3, "%02x", (unsigned int)digest[i]);
|
||||
|
||||
return digeststr;
|
||||
}
|
||||
|
||||
void JSI_Main::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<void, &QuitEngine>("Exit");
|
||||
@@ -122,4 +138,5 @@ void JSI_Main::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<bool, std::string, &HotkeyIsPressed_>("HotkeyIsPressed");
|
||||
scriptInterface.RegisterFunction<int, &GetFps>("GetFPS");
|
||||
scriptInterface.RegisterFunction<int, std::string, std::wstring, &GetTextWidth>("GetTextWidth");
|
||||
scriptInterface.RegisterFunction<std::string, std::string, &CalculateMD5>("CalculateMD5");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user