From 942fd2bcfd384a12c900999fe663202c87319a68 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 20:06:18 +0100 Subject: Switch simple iterator loops to use range-based for loops. --- src/modules/m_censor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/modules/m_censor.cpp') 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(), 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; -- cgit v1.3.1-10-gc9f91