summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-17 11:23:19 +0000
committerSadie Powell <sadie@witchery.services>2025-03-17 11:23:19 +0000
commit85fbc500d8bcc83a26f3227c90cb82896b767d62 (patch)
tree849d1de3ee40b5a0cf5f58a79cd263aa10f46cdc /modules
parent99bcc6d3b71d51391d1f7fc2be99734028ffa413 (diff)
Simplify the requirename logic.
Diffstat (limited to 'modules')
-rw-r--r--modules/operserv/os_shutdown.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/modules/operserv/os_shutdown.cpp b/modules/operserv/os_shutdown.cpp
index 75288c242..5ca4898b2 100644
--- a/modules/operserv/os_shutdown.cpp
+++ b/modules/operserv/os_shutdown.cpp
@@ -26,14 +26,12 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
- const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
- if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
+ if (Config->GetModule(this->owner).Get<bool>("requirename"))
{
- if (!params.empty())
- source.Reply(WRONG_NETWORK, source.command.c_str());
- else
+ if (params.empty())
OnSyntaxError(source, source.command);
+ else if (!params[0].equals_cs(Config->GetBlock("networkinfo").Get<Anope::string>("networkname")))
+ source.Reply(WRONG_NETWORK, source.command.c_str());
return;
}
@@ -68,14 +66,12 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
- const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
- if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
+ if (Config->GetModule(this->owner).Get<bool>("requirename"))
{
- if (!params.empty())
- source.Reply(WRONG_NETWORK, source.command.c_str());
- else
+ if (params.empty())
OnSyntaxError(source, source.command);
+ else if (!params[0].equals_cs(Config->GetBlock("networkinfo").Get<Anope::string>("networkname")))
+ source.Reply(WRONG_NETWORK, source.command.c_str());
return;
}
@@ -108,14 +104,12 @@ public:
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
- const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
- if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
+ if (Config->GetModule(this->owner).Get<bool>("requirename"))
{
- if (!params.empty())
- source.Reply(WRONG_NETWORK, source.command.c_str());
- else
+ if (params.empty())
OnSyntaxError(source, source.command);
+ else if (!params[0].equals_cs(Config->GetBlock("networkinfo").Get<Anope::string>("networkname")))
+ source.Reply(WRONG_NETWORK, source.command.c_str());
return;
}