Merge branch 'special-tokens'

This commit is contained in:
enWILLYado 2018-02-26 23:23:58 +01:00
commit b54bd99e97

View file

@ -252,12 +252,7 @@ static std::string & replace(std::string & str, const std::string & what, const
return str;
}
void Url::setPassword(const std::string & password)
{
m_password = password;
}
void Url::setUser(const std::string & user)
static std::string replaceWithTokens(const std::string & value)
{
char hosturl[1024] = {'\0'};
char hostname[1024] = {'\0'};
@ -288,11 +283,25 @@ void Url::setUser(const std::string & user)
}
// set user replacing tokens
m_user = user;
m_user = replace(m_user, "%HOST_NAME%", hostname);
m_user = replace(m_user, "%IP_ADD%", ipbuf);
std::string ret = value;
ret = replace(ret, "%HOST_NAME%", hostname);
ret = replace(ret, "%IP_ADD%", ipbuf);
return ret;
}
void Url::setPassword(const std::string & password)
{
m_password = replaceWithTokens(password);
}
void Url::setUser(const std::string & user)
{
m_user = replaceWithTokens(user);
}
void Url::copyKeystream(char* keystreamDest, const size_t keystreamLen) const
{
if(hasKeystream())