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_censor.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_censor.cpp')
| -rw-r--r-- | src/modules/m_censor.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 59a8e0545..d3640a802 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -79,14 +79,14 @@ class ModuleCensor : public Module return MOD_RES_PASSTHRU; } - for (censor_t::iterator index = censors.begin(); index != censors.end(); index++) + for (const auto& [find, replace] : censors) { size_t censorpos; - while ((censorpos = irc::find(details.text, index->first)) != std::string::npos) + while ((censorpos = irc::find(details.text, find)) != std::string::npos) { - if (index->second.empty()) + if (replace.empty()) { - const std::string msg = InspIRCd::Format("Your message to this channel contained a banned phrase (%s) and was blocked.", index->first.c_str()); + const std::string msg = InspIRCd::Format("Your message to this channel contained a banned phrase (%s) and was blocked.", find.c_str()); if (target.type == MessageTarget::TYPE_CHANNEL) user->WriteNumeric(Numerics::CannotSendTo(target.Get<Channel>(), msg)); else @@ -94,7 +94,7 @@ class ModuleCensor : public Module return MOD_RES_DENY; } - details.text.replace(censorpos, index->first.size(), index->second); + details.text.replace(censorpos, find.size(), replace); } } return MOD_RES_PASSTHRU; |
