diff options
Diffstat (limited to 'modules/m_rewrite.cpp')
-rw-r--r-- | modules/m_rewrite.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/modules/m_rewrite.cpp b/modules/m_rewrite.cpp index a69c575b9..b5218756c 100644 --- a/modules/m_rewrite.cpp +++ b/modules/m_rewrite.cpp @@ -74,10 +74,8 @@ struct Rewrite static Rewrite *Find(const Anope::string &client, const Anope::string &cmd) { - for (unsigned i = 0; i < rewrites.size(); ++i) + for (auto &r : rewrites) { - Rewrite &r = rewrites[i]; - if ((client.empty() || r.client.equals_ci(client)) && (r.source_message.equals_ci(cmd) || r.source_message.find_ci(cmd + " ") == 0)) return &r; } @@ -87,10 +85,8 @@ struct Rewrite static Rewrite *Match(const Anope::string &client, const std::vector<Anope::string> ¶ms) { - for (unsigned i = 0; i < rewrites.size(); ++i) + for (auto &r : rewrites) { - Rewrite &r = rewrites[i]; - if ((client.empty() || r.client.equals_ci(client)) && r.Matches(params)) return &r; } @@ -106,7 +102,7 @@ class RewriteCommand : public Command public: RewriteCommand(Module *creator) : Command(creator, "rewrite", 0, 0) { } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { std::vector<Anope::string> full_params = params; full_params.insert(full_params.begin(), source.command); @@ -125,7 +121,7 @@ class RewriteCommand : public Command Log() << "m_rewrite: Unable to rewrite '" << source.command << (!params.empty() ? " " + params[0] : "") << "'"; } - void OnServHelp(CommandSource &source) anope_override + void OnServHelp(CommandSource &source) override { Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command); if (r != NULL && !r->desc.empty()) @@ -135,7 +131,7 @@ class RewriteCommand : public Command } } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command); if (r != NULL && !r->desc.empty()) @@ -158,7 +154,7 @@ class ModuleRewrite : public Module { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Rewrite::rewrites.clear(); |