Also allow suffixing with -line[d] if an X-line is two characters.

This makes things easier for modules like require_auth in contrib
which has a GA-line.
This commit is contained in:
Sadie Powell 2023-07-25 09:48:50 +01:00
parent 2ee3fb86dd
commit 3f3c2583be
4 changed files with 7 additions and 7 deletions

View File

@ -647,7 +647,7 @@
# %duration% - The duration of the X-line.
# %expiry% - The date/time at which the X-line expires.
# %fulltype% - The type of X-line which was matched, suffixed with
# "-lined" if its name is a single character.
# "-lined" if its name is one or two characters.
# %reason% - The reason the X-line was added.
# %remaining% - The duration remaining on the X-line.
# %setter% - The name of the X-line setter.
@ -788,7 +788,7 @@
# %duration% - The duration of the X-line.
# %expiry% - The date/time at which the X-line expires.
# %fulltype% - The type of X-line which was matched, suffixed with
# "-lined" if its name is a single character.
# "-lined" if its name is one or two characters.
# %reason% - The reason the X-line was added.
# %remaining% - The duration remaining on the X-line.
# %setter% - The name of the X-line setter.

View File

@ -365,7 +365,7 @@ void ServerConfig::Fill()
NoSnoticeStack = options->getBool("nosnoticestack");
SyntaxHints = options->getBool("syntaxhints");
XLineMessage = options->getString("xlinemessage", "You're banned!", 1);
XLineQuit = options->getString("xlinequit", "%type%-lined: %reason%", 1);
XLineQuit = options->getString("xlinequit", "%fulltype%: %reason%", 1);
RestrictBannedUsers = options->getEnum("restrictbannedusers", ServerConfig::BUT_RESTRICT_NOTIFY, {
{ "no", ServerConfig::BUT_NORMAL },
{ "silent", ServerConfig::BUT_RESTRICT_SILENT },
@ -389,7 +389,7 @@ void ServerConfig::Fill()
CustomVersion = security->getString("customversion");
HideServer = security->getString("hideserver", {}, InspIRCd::IsFQDN);
MaxTargets = security->getNum<size_t>("maxtargets", 5, 1, 50);
XLineQuitPublic = security->getString("publicxlinequit", security->getBool("hidebans") ? "%type%-lined" : "");
XLineQuitPublic = security->getString("publicxlinequit", security->getBool("hidebans") ? "%fulltype%" : "");
// Read the <cidr> config.
const auto& cidr = ConfValue("cidr");

View File

@ -59,14 +59,14 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params)
if (xl->duration)
{
ServerInstance->SNO.WriteToSnoMask('X', "{} added a timed {}{} on {}, expires in {} (on {}): {}",
setter, params[0], params[0].length() == 1 ? "-line" : "",
setter, params[0], params[0].length() <= 2 ? "-line" : "",
params[1], Duration::ToString(xl->duration),
Time::ToString(xl->expiry), params[5]);
}
else
{
ServerInstance->SNO.WriteToSnoMask('X', "{} added a permanent {}{} on {}: {}",
setter, params[0], params[0].length() == 1 ? "-line" : "",
setter, params[0], params[0].length() <= 2 ? "-line" : "",
params[1], params[5]);
}

View File

@ -37,7 +37,7 @@ CmdResult CommandDelLine::Handle(User* user, Params& params)
if (ServerInstance->XLines->DelLine(params[1], params[0], reason, user))
{
ServerInstance->SNO.WriteToSnoMask('X', "{} removed {}{} on {}: {}", setter,
params[0], params[0].length() == 1 ? "-line" : "", params[1], reason);
params[0], params[0].length() <= 2 ? "-line" : "", params[1], reason);
return CmdResult::SUCCESS;
}
return CmdResult::FAILURE;