diff options
author | Sadie Powell <sadie@witchery.services> | 2023-10-10 21:14:50 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-10-11 15:51:52 +0100 |
commit | a3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch) | |
tree | 82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /modules/commands/cs_set.cpp | |
parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) |
Start migrating to range-based for loops.
Diffstat (limited to 'modules/commands/cs_set.cpp')
-rw-r--r-- | modules/commands/cs_set.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 116db161e..0456f56b8 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -37,10 +37,8 @@ class CommandCSSet : public Command Anope::string this_name = source.command; bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"), hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands"); - for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) + for (const auto &[c_name, info] : source.service->commands) { - const Anope::string &c_name = it->first; - const CommandInfo &info = it->second; if (c_name.find_ci(this_name + " ") == 0) { if (info.hide) @@ -56,7 +54,7 @@ class CommandCSSet : public Command else if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission)) continue; - source.command = it->first; + source.command = c_name; c->OnServHelp(source); } } @@ -1112,13 +1110,13 @@ class CSSet : public Module const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(s); Anope::string modes; - for (Channel::ModeList::const_iterator it = ci->last_modes.begin(); it != ci->last_modes.end(); ++it) + for (const auto &[last_mode, last_value] : ci->last_modes) { if (!modes.empty()) modes += " "; - modes += it->first; - if (!it->second.empty()) - modes += "," + it->second; + modes += last_mode; + if (!last_value.empty()) + modes += "," + last_value; } data["last_modes"] << modes; } @@ -1199,8 +1197,8 @@ class CSSet : public Module if (c->ci && keep_modes.HasExt(c->ci)) { Channel::ModeList ml = c->ci->last_modes; - for (Channel::ModeList::iterator it = ml.begin(); it != ml.end(); ++it) - c->SetMode(c->ci->WhoSends(), it->first, it->second); + for (const auto &[last_mode, last_value] : c->ci->last_modes) + c->SetMode(c->ci->WhoSends(), last_mode, last_value); } } |