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_tline.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_tline.cpp')
| -rw-r--r-- | src/modules/m_tline.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index f85d986cb..6e75640cc 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -42,17 +42,16 @@ class CommandTline : public Command unsigned int n_match_host = 0; unsigned int n_match_ip = 0; - const user_hash& users = ServerInstance->Users.GetUsers(); - for (user_hash::const_iterator u = users.begin(); u != users.end(); ++u) + for (const auto& [_, u] : ServerInstance->Users.GetUsers()) { - if (InspIRCd::Match(u->second->GetFullRealHost(),parameters[0])) + if (InspIRCd::Match(u->GetFullRealHost(),parameters[0])) { n_matched++; n_match_host++; } else { - std::string host = u->second->ident + "@" + u->second->GetIPString(); + std::string host = u->ident + "@" + u->GetIPString(); if (InspIRCd::MatchCIDR(host, parameters[0])) { n_matched++; @@ -61,7 +60,7 @@ class CommandTline : public Command } } - unsigned long n_counted = users.size(); + unsigned long n_counted = ServerInstance->Users.GetUsers().size(); if (n_matched) { float p = (n_matched / (float)n_counted) * 100; |
