Add constructors to the TokenList class.

This commit is contained in:
Sadie Powell 2022-01-18 00:19:44 +00:00
parent 5881e6f6a3
commit 4856a8f967
3 changed files with 12 additions and 1 deletions

View File

@ -31,6 +31,12 @@ class CoreExport TokenList final
insp::flat_set<std::string, irc::insensitive_swo> tokens;
public:
/** Creates a new empty token list. */
TokenList() = default;
/** Creates a new token list from a list of tokens. */
TokenList(const std::string& tokenlist);
/** Adds a space-delimited list of tokens to the token list.
* @param tokenlist The list of space-delimited tokens to add.
*/

View File

@ -201,6 +201,11 @@ bool InspIRCd::TimingSafeCompare(const std::string& one, const std::string& two)
return (diff == 0);
}
TokenList::TokenList(const std::string& tokenlist)
{
AddList(tokenlist);
}
void TokenList::AddList(const std::string& tokenlist)
{
std::string token;

View File

@ -90,8 +90,8 @@ class WebIRCHost final
, fingerprint(fp)
, password(pass)
, passhash(hash)
, trustedflags(flags)
{
trustedflags.AddList(flags);
}
bool IsFlagTrusted(const std::string& flag) const