aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_dnsbl.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-06-15 12:19:23 +0100
committerGravatar Sadie Powell2022-06-15 12:30:24 +0100
commit429b973af669230e2a81fc83d74bdd56b88549c8 (patch)
treeef5f06becfd39d96b63771d03312cdb716e3ae02 /src/modules/m_dnsbl.cpp
parentUpdate UNIX CI images to use the latest tooling. (diff)
Add a basic function for templating strings.
Diffstat (limited to 'src/modules/m_dnsbl.cpp')
-rw-r--r--src/modules/m_dnsbl.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index cbeac201b..ee4d07f6a 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -154,7 +154,7 @@ public:
+ tag->source.str());
}
- reason = tag->getString("reason", "Your IP (%ip%) has been blacklisted by a DNSBL.", 1, ServerInstance->Config->Limits.MaxLine);
+ reason = tag->getString("reason", "Your IP (%ip%) has been blacklisted by the %dnsbl% DNSBL.", 1, ServerInstance->Config->Limits.MaxLine);
timeout = static_cast<unsigned int>(tag->getDuration("timeout", 0, 1, 60));
markident = tag->getString("ident");
markhost = tag->getString("host");
@@ -264,14 +264,11 @@ public:
if (match)
{
- std::string reason = ConfEntry->reason;
- std::string::size_type x = reason.find("%ip%");
- while (x != std::string::npos)
- {
- reason.erase(x, 4);
- reason.insert(x, them->GetIPString());
- x = reason.find("%ip%");
- }
+ const std::string reason = Template::Replace(ConfEntry->reason, {
+ { "dnsbl", ConfEntry->name },
+ { "ip", them->GetIPString() },
+ { "result", ConvToStr(result) },
+ });
ConfEntry->stats_hits++;