aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-01-02 21:05:19 +0000
committerGravatar Sadie Powell2023-01-02 21:05:19 +0000
commit137dbe2fdcf2b01bc67a95577251f98e4c737c17 (patch)
tree3afcd7c378adc0a7560a6259ae7387faa42b0b63 /src
parentAdd some useful aliases to OperType. (diff)
Allow getting all of the oper command/mode/snomask privs.
Diffstat (limited to 'src')
-rw-r--r--src/users.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 5cb862e8c..33c380c83 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1290,8 +1290,11 @@ void OperType::Configure(const std::shared_ptr<ConfigTag>& tag, bool merge)
MergeTag(tag);
}
-std::string OperType::GetCommands() const
+std::string OperType::GetCommands(bool all) const
{
+ if (all)
+ return commands.ToString();
+
std::vector<std::string> ret;
for (const auto& [_, cmd] : ServerInstance->Parser.GetCommands())
{
@@ -1302,24 +1305,24 @@ std::string OperType::GetCommands() const
return stdalgo::string::join(ret);
}
-std::string OperType::GetModes(ModeType mt) const
+std::string OperType::GetModes(ModeType mt, bool all) const
{
std::string ret;
for (const auto& [_, mh] : ServerInstance->Modes.GetModes(mt))
{
- if (mh->NeedsOper() && CanUseMode(mh))
+ if ((all || mh->NeedsOper()) && CanUseMode(mh))
ret.push_back(mh->GetModeChar());
}
std::sort(ret.begin(), ret.end());
return ret;
}
-std::string OperType::GetSnomasks() const
+std::string OperType::GetSnomasks(bool all) const
{
std::string ret;
for (unsigned char sno = 'A'; sno <= 'z'; ++sno)
{
- if (ServerInstance->SNO.IsSnomaskUsable(sno) && CanUseSnomask(sno))
+ if ((all || ServerInstance->SNO.IsSnomaskUsable(sno)) && CanUseSnomask(sno))
ret.push_back(sno);
}
std::sort(ret.begin(), ret.end());