Special tokens to more fields
Special tokens to password field.
This commit is contained in:
parent
cd77d02a81
commit
17bf8907a9
1 changed files with 18 additions and 9 deletions
|
@ -252,12 +252,7 @@ static std::string & replace(std::string & str, const std::string & what, const
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Url::setPassword(const std::string & password)
|
static std::string replaceWithTokens(const std::string & value)
|
||||||
{
|
|
||||||
m_password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Url::setUser(const std::string & user)
|
|
||||||
{
|
{
|
||||||
char hosturl[1024] = {'\0'};
|
char hosturl[1024] = {'\0'};
|
||||||
char hostname[1024] = {'\0'};
|
char hostname[1024] = {'\0'};
|
||||||
|
@ -288,11 +283,25 @@ void Url::setUser(const std::string & user)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set user replacing tokens
|
// set user replacing tokens
|
||||||
m_user = user;
|
std::string ret = value;
|
||||||
m_user = replace(m_user, "%HOST_NAME%", hostname);
|
ret = replace(ret, "%HOST_NAME%", hostname);
|
||||||
m_user = replace(m_user, "%IP_ADD%", ipbuf);
|
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
|
void Url::copyKeystream(char* keystreamDest, const size_t keystreamLen) const
|
||||||
{
|
{
|
||||||
if(hasKeystream())
|
if(hasKeystream())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue