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/m_xmlrpc_main.cpp | |
parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) |
Start migrating to range-based for loops.
Diffstat (limited to 'modules/m_xmlrpc_main.cpp')
-rw-r--r-- | modules/m_xmlrpc_main.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/modules/m_xmlrpc_main.cpp b/modules/m_xmlrpc_main.cpp index a01e4969c..cdc12ed7f 100644 --- a/modules/m_xmlrpc_main.cpp +++ b/modules/m_xmlrpc_main.cpp @@ -142,8 +142,8 @@ class MyXMLRPCEvent : public XMLRPCEvent request.reply("uplinkname", Me->GetLinks().front()->GetName()); { Anope::string buf; - for (std::set<Anope::string>::iterator it = Servers::Capab.begin(); it != Servers::Capab.end(); ++it) - buf += " " + *it; + for (const auto &capab : Servers::Capab) + buf += " " + capab; if (!buf.empty()) buf.erase(buf.begin()); request.reply("uplinkcapab", buf); @@ -166,21 +166,18 @@ class MyXMLRPCEvent : public XMLRPCEvent { request.reply("bancount", stringify(c->HasMode("BAN"))); int count = 0; - std::vector<Anope::string> v = c->GetModeList("BAN"); - for (unsigned int i = 0; i < v.size(); ++i) - request.reply("ban" + stringify(++count), iface->Sanitize(v[i])); + for (auto &ban : c->GetModeList("BAN")) + request.reply("ban" + stringify(++count), iface->Sanitize(ban)); request.reply("exceptcount", stringify(c->HasMode("EXCEPT"))); count = 0; - v = c->GetModeList("EXCEPT"); - for (unsigned int i = 0; i < v.size(); ++i) - request.reply("except" + stringify(++count), iface->Sanitize(v[i])); + for (auto &except : c->GetModeList("EXCEPT")) + request.reply("except" + stringify(++count), iface->Sanitize(except)); request.reply("invitecount", stringify(c->HasMode("INVITEOVERRIDE"))); count = 0; - v = c->GetModeList("INVITEOVERRIDE"); - for (unsigned int i = 0; i < v.size(); ++i) - request.reply("invite" + stringify(++count), iface->Sanitize(v[i])); + for (auto &invite : c->GetModeList("INVITEOVERRIDE")) + request.reply("invite" + stringify(++count), iface->Sanitize(invite)); Anope::string users; for (Channel::ChanUserList::const_iterator it = c->users.begin(); it != c->users.end(); ++it) @@ -249,18 +246,13 @@ class MyXMLRPCEvent : public XMLRPCEvent void DoOperType(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) { - for (unsigned i = 0; i < Config->MyOperTypes.size(); ++i) + for (auto *ot : Config->MyOperTypes) { - OperType *ot = Config->MyOperTypes[i]; Anope::string perms; - - std::list<Anope::string> privs = ot->GetPrivs(); - for (std::list<Anope::string>::const_iterator it2 = privs.begin(), it2_end = privs.end(); it2 != it2_end; ++it2) - perms += " " + *it2; - - std::list<Anope::string> commands = ot->GetCommands(); - for (std::list<Anope::string>::const_iterator it2 = commands.begin(), it2_end = commands.end(); it2 != it2_end; ++it2) - perms += " " + *it2; + for (const auto &priv : ot->GetPrivs()) + perms += " " + priv; + for (const auto &command : ot->GetCommands()) + perms += " " + command; request.reply(ot->GetName(), perms); } } |