From b848ca14335adcb924acb7977d93e0d76b9437b7 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 29 Dec 2006 21:27:39 +0000 Subject: Fixed search and replace, code pilfered from m_alias (i think someone misread the help for std::string::replace...) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6162 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_dnsbl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 351ef688f..03b691ece 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -94,11 +94,12 @@ class DNSBLResolver : public Resolver if (bitmask != 0) { std::string reason = ConfEntry->reason; - - std::string::size_type pos; - while ((pos = reason.find("%ip%")) != std::string::npos) + std::string::size_type x = reason.find("%ip%"); + while (x != std::string::npos) { - reason.replace(pos, 4, them->GetIPString()); + reason.erase(x, 4); + reason.insert(x, "%ip%"); + x = reason.find("%ip%"); } ServerInstance->WriteOpers("*** Connecting user %s detected as being on a DNS blacklist (%s) with result %d", them->GetFullRealHost(), ConfEntry->name.c_str(), bitmask); -- cgit v1.2.3