Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-05-12 19:57:37 +02:00
commit ff5a82ec4f
4 changed files with 19 additions and 11 deletions

View file

@ -5798,3 +5798,11 @@ NLMISC_COMMAND(time, "Shows information about the current time", "")
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
return true;
}
NLMISC_COMMAND(playedTime, "Display character played time", "")
{
ucstring msg = CI18N::get("uiPlayedTime");
strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime));
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
return true;
}

View file

@ -261,11 +261,11 @@ bool CCurlHttpClient::receive(string &res, bool verbose)
{
if (verbose)
{
nldebug("Receiving %u bytes", _ReceiveBuffer.size());
nldebug("Receiving %u bytes", (uint)_ReceiveBuffer.size());
}
res.clear();
if (_ReceiveBuffer.size())
if (!_ReceiveBuffer.empty())
res.assign((const char*)&(*(_ReceiveBuffer.begin())), _ReceiveBuffer.size());
_ReceiveBuffer.clear();
return true;

View file

@ -2798,7 +2798,7 @@ string checkLogin(const string &login, const string &password, const string &cli
if (!login.empty())
{
// ask server for salt
if(!HttpClient.sendGet(url + "?cmd=ask&login=" + login + "&lg=" + ClientCfg.LanguageCode, "", pPM->isVerboseLog()))
if(!HttpClient.sendGet(url + "?cmd=ask&cp=2&login=" + login + "&lg=" + ClientCfg.LanguageCode, "", pPM->isVerboseLog()))
return "Can't send (error code 60)";
if(pPM->isVerboseLog()) nlinfo("Sent request for password salt");
@ -2828,7 +2828,7 @@ string checkLogin(const string &login, const string &password, const string &cli
return res;
}
// send login + crypted password + client app and cp=1 (as crypted password)
// send login + crypted password + client app and cp=2 (as crypted password)
if(!HttpClient.connectToLogin())
return "Can't connect (error code 63)";
@ -2843,13 +2843,13 @@ string checkLogin(const string &login, const string &password, const string &cli
{
std::string cryptedPassword = CCrypt::crypt(password, Salt);
if(!HttpClient.sendGet(url + "?cmd=login&login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=1" + "&lg=" + ClientCfg.LanguageCode + customParameters))
if(!HttpClient.sendGet(url + "?cmd=login&login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=2" + "&lg=" + ClientCfg.LanguageCode + customParameters))
return "Can't send (error code 2)";
}
else
{
// don't send login and password if empty
if(!HttpClient.sendGet(url + "?cmd=login&clientApplication=" + clientApp + "&cp=1" + "&lg=" + ClientCfg.LanguageCode + customParameters))
if(!HttpClient.sendGet(url + "?cmd=login&clientApplication=" + clientApp + "&cp=2" + "&lg=" + ClientCfg.LanguageCode + customParameters))
return "Can't send (error code 2)";
}
@ -2930,7 +2930,7 @@ string checkLogin(const string &login, const string &password, const string &cli
// standard ryzom login sequence
std::string cryptedPassword = CCrypt::crypt(password, Salt);
if(!HttpClient.sendGet(url + "?login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=1"))
if(!HttpClient.sendGet(url + "?login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=2"))
return "Can't send (error code 2)";
/*
if(!send(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?login="+login+"&password="+password+"&clientApplication="+clientApp))
@ -3034,12 +3034,12 @@ string selectShard(uint32 shardId, string &cookie, string &addr)
if(LoginPassword.empty()) return "Empty Password (error code 9)";
if(ClientApp.empty()) return "Empty Client Application (error code 10)";
// send login + crypted password + client app and cp=1 (as crypted password)
// send login + crypted password + client app and cp=2 (as crypted password)
std::string cryptedPassword = CCrypt::crypt(LoginPassword, Salt);
std::string url = ClientCfg.ConfigFile.getVar("StartupHost").asString() + ClientCfg.ConfigFile.getVar("StartupPage").asString();
if(!HttpClient.sendGet(url + "?cmd=login&shardid=" + toString(shardId) + "&login=" + LoginLogin + "&password=" + cryptedPassword + "&clientApplication=" + ClientApp + "&cp=1"))
if(!HttpClient.sendGet(url + "?cmd=login&shardid=" + toString(shardId) + "&login=" + LoginLogin + "&password=" + cryptedPassword + "&clientApplication=" + ClientApp + "&cp=2"))
return "Can't send (error code 11)";
string res;

View file

@ -193,14 +193,14 @@ bool CHttpClient::receive(string &res, bool verbose)
if (_Sock.receive((uint8*)buf, size, false) == CSock::Ok)
{
if (verbose) nlinfo("Received OK %d bytes", size);
if (verbose) nlinfo("Received OK %u bytes", size);
buf[1023] = '\0';
res += (char*)buf;
//nlinfo("block received '%s'", buf);
}
else
{
if (verbose) nlinfo("Received CLOSE %d bytes", size);
if (verbose) nlinfo("Received CLOSE %u bytes", size);
buf[size] = '\0';
res += (char*)buf;
//nlwarning ("server connection closed");