From f8614ea98581fb303abc36c792be6ba60b3c8b42 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 26 Mar 2023 22:39:42 +0100 Subject: Allow customising the message shown when hiding an X-line ban. --- src/xline.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/xline.cpp') diff --git a/src/xline.cpp b/src/xline.cpp index 6cc44447f..c4b3b9287 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -564,20 +564,26 @@ bool XLine::IsBurstable() void XLine::DefaultApply(User* u, const std::string& line, bool bancache) { - const std::string banReason = line + "-lined: " + reason; - if (!ServerInstance->Config->XLineMessage.empty()) u->WriteNumeric(ERR_YOUREBANNEDCREEP, ServerInstance->Config->XLineMessage); - if (ServerInstance->Config->HideBans) - ServerInstance->Users.QuitUser(u, line + "-lined", &banReason); + const std::string banreason = line + "-lined: " + reason; + if (ServerInstance->Config->HideLines.empty()) + ServerInstance->Users.QuitUser(u, banreason); else - ServerInstance->Users.QuitUser(u, banReason); + { + const std::string publicreason = Template::Replace(ServerInstance->Config->HideLines, + { + { "reason", banreason }, + { "type", line }, + }); + ServerInstance->Users.QuitUser(u, publicreason, &banreason); + } if (bancache) { ServerInstance->Logs.Debug("BANCACHE", "BanCache: Adding positive hit (" + line + ") for " + u->GetAddress()); - ServerInstance->BanCache.AddHit(u->GetAddress(), this->type, banReason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0)); + ServerInstance->BanCache.AddHit(u->GetAddress(), this->type, banreason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0)); } } -- cgit v1.3.1-10-gc9f91