diff options
| author | 2021-04-06 20:06:18 +0100 | |
|---|---|---|
| committer | 2021-04-07 10:36:11 +0100 | |
| commit | 942fd2bcfd384a12c900999fe663202c87319a68 (patch) | |
| tree | c2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_cgiirc.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
| download | inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.gz inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.bz2 inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.zip | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_cgiirc.cpp')
| -rw-r--r-- | src/modules/m_cgiirc.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index be4c9d74c..699669418 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -63,14 +63,14 @@ class IdentHost bool Matches(LocalUser* user) const { - for (MaskList::const_iterator iter = hostmasks.begin(); iter != hostmasks.end(); ++iter) + for (const auto& mask : hostmasks) { // Does the user's hostname match this hostmask? - if (InspIRCd::Match(user->GetRealHost(), *iter, ascii_case_insensitive_map)) + if (InspIRCd::Match(user->GetRealHost(), mask, ascii_case_insensitive_map)) return true; // Does the user's IP address match this hostmask? - if (InspIRCd::MatchCIDR(user->GetIPString(), *iter, ascii_case_insensitive_map)) + if (InspIRCd::MatchCIDR(user->GetIPString(), mask, ascii_case_insensitive_map)) return true; } @@ -108,14 +108,14 @@ class WebIRCHost if (!fingerprint.empty() && !InspIRCd::TimingSafeCompare(fp, fingerprint)) return false; - for (MaskList::const_iterator iter = hostmasks.begin(); iter != hostmasks.end(); ++iter) + for (const auto& mask : hostmasks) { // Does the user's hostname match this hostmask? - if (InspIRCd::Match(user->GetRealHost(), *iter, ascii_case_insensitive_map)) + if (InspIRCd::Match(user->GetRealHost(), mask, ascii_case_insensitive_map)) return true; // Does the user's IP address match this hostmask? - if (InspIRCd::MatchCIDR(user->GetIPString(), *iter, ascii_case_insensitive_map)) + if (InspIRCd::MatchCIDR(user->GetIPString(), mask, ascii_case_insensitive_map)) return true; } @@ -231,10 +231,10 @@ class CommandWebIRC : public SplitCommand if (user->registered == REG_ALL || realhost.Get(user)) return CmdResult::FAILURE; - for (std::vector<WebIRCHost>::const_iterator iter = hosts.begin(); iter != hosts.end(); ++iter) + for (const auto& host : hosts) { // If we don't match the host then skip to the next host. - if (!iter->Matches(user, parameters[0], sslapi)) + if (!host.Matches(user, parameters[0], sslapi)) continue; irc::sockets::sockaddrs ipaddr; @@ -425,10 +425,10 @@ class ModuleCgiIRC if (cmdwebirc.realhost.Get(user)) return MOD_RES_PASSTHRU; - for (std::vector<IdentHost>::const_iterator iter = hosts.begin(); iter != hosts.end(); ++iter) + for (const auto& host : hosts) { // If we don't match the host then skip to the next host. - if (!iter->Matches(user)) + if (!host.Matches(user)) continue; // We have matched an <cgihost> block! Try to parse the encoded IPv4 address @@ -441,7 +441,7 @@ class ModuleCgiIRC cmdwebirc.realhost.Set(user, user->GetRealHost()); cmdwebirc.realip.Set(user, user->GetIPString()); - const std::string& newident = iter->GetIdent(); + const std::string& newident = host.GetIdent(); cmdwebirc.WriteLog("Connecting user %s is using an ident gateway; changing their IP from %s to %s and their ident from %s to %s.", user->uuid.c_str(), user->GetIPString().c_str(), address.addr().c_str(), user->ident.c_str(), newident.c_str()); |
