aboutsummaryrefslogtreecommitdiff
path: root/src/inspstring.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-04-05 15:48:26 +0100
committerGravatar Sadie Powell2022-04-05 15:51:10 +0100
commit9e3784dc0b5a192235cbb2b5fd862cd7315281a8 (patch)
tree195766bfb06e56e586cd7472f2fde5b679624046 /src/inspstring.cpp
parentRemove a weird incorrect comment. (diff)
Fix converting a token list to a string.
Fixes showing oper privs in /CHECK.
Diffstat (limited to 'src/inspstring.cpp')
-rw-r--r--src/inspstring.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/inspstring.cpp b/src/inspstring.cpp
index 3cbf06602..812719b08 100644
--- a/src/inspstring.cpp
+++ b/src/inspstring.cpp
@@ -210,9 +210,19 @@ void TokenList::Remove(const std::string& token)
std::string TokenList::ToString() const
{
- std::string buffer(permissive ? "* " : "-* ");
- buffer.append(stdalgo::string::join(tokens));
- return buffer;
+ if (permissive)
+ {
+ // If the token list is in permissive mode then the tokens are a list
+ // of disallowed tokens.
+ std::string buffer("*");
+ for (TokenMap::const_iterator it = tokens.begin(); it != tokens.end(); ++it)
+ buffer.append(" -").append(*it);
+ return buffer;
+ }
+
+ // If the token list is not in permissive mode then the token list is just
+ // a list of allowed tokens.
+ return stdalgo::string::join(tokens);
}
bool TokenList::operator==(const TokenList& other) const