mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Make the length optional in when adding a [EGKQRZ]-line.
The shun module already behaves like this but the docs were not correct.
This commit is contained in:
parent
eaac5cebe1
commit
6cb0f8a6d1
@ -663,9 +663,9 @@ Changes the real name of the user to the specified real name.
|
|||||||
Changes the username of the user to the specified value.
|
Changes the username of the user to the specified value.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="shun" title="/SHUN <nick!user@host>[,<nick!user@host>]+ [<duration> :<reason>]" value="
|
<helptopic key="shun" title="/SHUN <nick!user@host>[,<nick!user@host>]+ [[<duration>] :<reason>]" value="
|
||||||
Sets or removes a shun (global server-side ignore) on a nick!user@host mask.
|
Sets or removes a shun (global server-side ignore) on a nick!user@host mask.
|
||||||
You must specify all three parameters to add a shun, and one parameter
|
You must specify two or more parameters to add a shun, and one parameter
|
||||||
to remove a shun (just the nick!user@host).
|
to remove a shun (just the nick!user@host).
|
||||||
|
|
||||||
The duration may be specified in seconds, or in the format
|
The duration may be specified in seconds, or in the format
|
||||||
@ -736,9 +736,9 @@ Unloads a module from all linked servers.
|
|||||||
Unloads and reloads a module on all linked servers.
|
Unloads and reloads a module on all linked servers.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="kline" title="/KLINE <user@host>[,<user@host>]+ [<duration> :<reason>]" value="
|
<helptopic key="kline" title="/KLINE <user@host>[,<user@host>]+ [[<duration>] :<reason>]" value="
|
||||||
Sets or removes a K-line (local user@host based ban) on a user@host mask.
|
Sets or removes a K-line (local user@host based ban) on a user@host mask.
|
||||||
You must specify all three parameters to add a ban, and one parameter
|
You must specify two or more parameters to add a ban, and one parameter
|
||||||
to remove a ban (just the user@host).
|
to remove a ban (just the user@host).
|
||||||
|
|
||||||
The duration may be specified in seconds, or in the format
|
The duration may be specified in seconds, or in the format
|
||||||
@ -746,9 +746,9 @@ The duration may be specified in seconds, or in the format
|
|||||||
five minutes and six seconds. All fields in this format are optional.
|
five minutes and six seconds. All fields in this format are optional.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="zline" title="/ZLINE <ipmask>[,<ipmask>]+ [<duration> :<reason>]" value="
|
<helptopic key="zline" title="/ZLINE <ipmask>[,<ipmask>]+ [[<duration>] :<reason>]" value="
|
||||||
Sets or removes a Z-line (global IP based ban) on an IP mask.
|
Sets or removes a Z-line (global IP based ban) on an IP mask.
|
||||||
You must specify all three parameters to add a ban, and one parameter
|
You must specify two or more parameters to add a ban, and one parameter
|
||||||
to remove a ban (just the ipmask).
|
to remove a ban (just the ipmask).
|
||||||
|
|
||||||
The duration may be specified in seconds, or in the format
|
The duration may be specified in seconds, or in the format
|
||||||
@ -756,9 +756,9 @@ The duration may be specified in seconds, or in the format
|
|||||||
five minutes and six seconds. All fields in this format are optional.
|
five minutes and six seconds. All fields in this format are optional.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="qline" title="/QLINE <nickmask>[,<nickmask>]+ [<duration> :<reason>]" value="
|
<helptopic key="qline" title="/QLINE <nickmask>[,<nickmask>]+ [[<duration>] :<reason>]" value="
|
||||||
Sets or removes a Q-line (global nick based ban) on a nick mask.
|
Sets or removes a Q-line (global nick based ban) on a nick mask.
|
||||||
You must specify all three parameters to add a ban, and one parameter
|
You must specify two or more parameters to add a ban, and one parameter
|
||||||
to remove a ban (just the nickmask).
|
to remove a ban (just the nickmask).
|
||||||
|
|
||||||
The duration may be specified in seconds, or in the format
|
The duration may be specified in seconds, or in the format
|
||||||
@ -766,9 +766,9 @@ The duration may be specified in seconds, or in the format
|
|||||||
five minutes and six seconds. All fields in this format are optional.
|
five minutes and six seconds. All fields in this format are optional.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="gline" title="/GLINE <user@host>[,<user@host>]+ [<duration> :<reason>]" value="
|
<helptopic key="gline" title="/GLINE <user@host>[,<user@host>]+ [[<duration>] :<reason>]" value="
|
||||||
Sets or removes a G-line (global user@host based ban) on a user@host mask.
|
Sets or removes a G-line (global user@host based ban) on a user@host mask.
|
||||||
You must specify all three parameters to add a ban, and one
|
You must specify two or more parameters to add a ban, and one
|
||||||
parameter to remove a ban (just the user@host).
|
parameter to remove a ban (just the user@host).
|
||||||
|
|
||||||
The duration may be specified in seconds, or in the format
|
The duration may be specified in seconds, or in the format
|
||||||
@ -776,7 +776,7 @@ The duration may be specified in seconds, or in the format
|
|||||||
five minutes and six seconds. All fields in this format are optional.
|
five minutes and six seconds. All fields in this format are optional.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="eline" title="/ELINE <user@host>[,<user@host>]+ [<duration> :<reason>]" value="
|
<helptopic key="eline" title="/ELINE <user@host>[,<user@host>]+ [[<duration>] :<reason>]" value="
|
||||||
Sets or removes a E-line (global user@host ban exception) on a user@host mask.
|
Sets or removes a E-line (global user@host ban exception) on a user@host mask.
|
||||||
You must specify at least 3 parameters to add an exception, and one
|
You must specify at least 3 parameters to add an exception, and one
|
||||||
parameter to remove an exception (just the user@host).
|
parameter to remove an exception (just the user@host).
|
||||||
@ -795,9 +795,9 @@ can be negated by any E-line that matches.
|
|||||||
Sends a message to all +w users.
|
Sends a message to all +w users.
|
||||||
">
|
">
|
||||||
|
|
||||||
<helptopic key="rline" title="/RLINE <regex> [<duration> :<reason>]" value="
|
<helptopic key="rline" title="/RLINE <regex> [[<duration>] :<reason>]" value="
|
||||||
Sets or removes an R-line (global regex ban) on a n!u@h\srealname mask. You
|
Sets or removes an R-line (global regex ban) on a n!u@h\srealname mask. You
|
||||||
must specify all three parameters to add an R-line, and one parameter
|
must specify two or more parameters to add an R-line, and one parameter
|
||||||
to remove an R-line (just the regex).
|
to remove an R-line (just the regex).
|
||||||
|
|
||||||
The duration may be specified in seconds, or in the format
|
The duration may be specified in seconds, or in the format
|
||||||
|
@ -33,7 +33,7 @@ CommandEline::CommandEline(Module* parent)
|
|||||||
: Command(parent, "ELINE", 1, 3)
|
: Command(parent, "ELINE", 1, 3)
|
||||||
{
|
{
|
||||||
access_needed = CmdAccess::OPERATOR;
|
access_needed = CmdAccess::OPERATOR;
|
||||||
syntax = { "<user@host>[,<user@host>]+ [<duration> :<reason>]" };
|
syntax = { "<user@host>[,<user@host>]+ [[<duration>] :<reason>]" };
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdResult CommandEline::Handle(User* user, const Params& parameters)
|
CmdResult CommandEline::Handle(User* user, const Params& parameters)
|
||||||
@ -42,7 +42,7 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
|
|
||||||
std::string target = parameters[0];
|
std::string target = parameters[0];
|
||||||
if (parameters.size() >= 3)
|
if (parameters.size() > 1)
|
||||||
{
|
{
|
||||||
UserHostPair ih;
|
UserHostPair ih;
|
||||||
auto* find = ServerInstance->Users.Find(target, true);
|
auto* find = ServerInstance->Users.Find(target, true);
|
||||||
@ -65,25 +65,25 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters)
|
|||||||
if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'E', "hostmasks"))
|
if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'E', "hostmasks"))
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
|
|
||||||
unsigned long duration;
|
unsigned long duration = 0;
|
||||||
if (!Duration::TryFrom(parameters[1], duration))
|
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||||
{
|
{
|
||||||
user->WriteNotice("*** Invalid duration for E-line.");
|
user->WriteNotice("*** Invalid duration for E-line.");
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* el = new ELine(ServerInstance->Time(), duration, user->nick, parameters[2], ih.first, ih.second);
|
auto* el = new ELine(ServerInstance->Time(), duration, user->nick, parameters.back(), ih.first, ih.second);
|
||||||
if (ServerInstance->XLines->AddLine(el, user))
|
if (ServerInstance->XLines->AddLine(el, user))
|
||||||
{
|
{
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent E-line on {}: {}", user->nick, target, parameters[2]);
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent E-line on {}: {}",
|
||||||
|
user->nick, target, el->reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed E-line on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed E-line on {}, expires in {} (on {}): {}",
|
||||||
user->nick, target, Duration::ToString(duration),
|
user->nick, target, Duration::ToString(duration), Time::FromNow(duration), el->reason);
|
||||||
Time::FromNow(duration), parameters[2]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -34,7 +34,7 @@ CommandGline::CommandGline(Module* parent)
|
|||||||
: Command(parent, "GLINE", 1, 3)
|
: Command(parent, "GLINE", 1, 3)
|
||||||
{
|
{
|
||||||
access_needed = CmdAccess::OPERATOR;
|
access_needed = CmdAccess::OPERATOR;
|
||||||
syntax = { "<user@host>[,<user@host>]+ [<duration> :<reason>]" };
|
syntax = { "<user@host>[,<user@host>]+ [[<duration>] :<reason>]" };
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdResult CommandGline::Handle(User* user, const Params& parameters)
|
CmdResult CommandGline::Handle(User* user, const Params& parameters)
|
||||||
@ -43,7 +43,7 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
|
|
||||||
std::string target = parameters[0];
|
std::string target = parameters[0];
|
||||||
if (parameters.size() >= 3)
|
if (parameters.size() > 1)
|
||||||
{
|
{
|
||||||
UserHostPair ih;
|
UserHostPair ih;
|
||||||
auto* find = ServerInstance->Users.Find(target, true);
|
auto* find = ServerInstance->Users.Find(target, true);
|
||||||
@ -72,25 +72,25 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long duration;
|
unsigned long duration = 0;
|
||||||
if (!Duration::TryFrom(parameters[1], duration))
|
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||||
{
|
{
|
||||||
user->WriteNotice("*** Invalid duration for G-line.");
|
user->WriteNotice("*** Invalid duration for G-line.");
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* gl = new GLine(ServerInstance->Time(), duration, user->nick, parameters[2], ih.first, ih.second);
|
auto* gl = new GLine(ServerInstance->Time(), duration, user->nick, parameters.back(), ih.first, ih.second);
|
||||||
if (ServerInstance->XLines->AddLine(gl, user))
|
if (ServerInstance->XLines->AddLine(gl, user))
|
||||||
{
|
{
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent G-line on {}: {}", user->nick, target, parameters[2]);
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent G-line on {}: {}",
|
||||||
|
user->nick, target, gl->reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed G-line on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed G-line on {}, expires in {} (on {}): {}",
|
||||||
user->nick, target, Duration::ToString(duration),
|
user->nick, target, Duration::ToString(duration), Time::FromNow(duration), gl->reason);
|
||||||
Time::FromNow(duration), parameters[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInstance->XLines->ApplyLines();
|
ServerInstance->XLines->ApplyLines();
|
||||||
|
@ -34,7 +34,7 @@ CommandKline::CommandKline(Module* parent)
|
|||||||
: Command(parent, "KLINE", 1, 3)
|
: Command(parent, "KLINE", 1, 3)
|
||||||
{
|
{
|
||||||
access_needed = CmdAccess::OPERATOR;
|
access_needed = CmdAccess::OPERATOR;
|
||||||
syntax = { "<user@host>[,<user@host>]+ [<duration> :<reason>]" };
|
syntax = { "<user@host>[,<user@host>]+ [[<duration>] :<reason>]" };
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdResult CommandKline::Handle(User* user, const Params& parameters)
|
CmdResult CommandKline::Handle(User* user, const Params& parameters)
|
||||||
@ -43,7 +43,7 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
|
|
||||||
std::string target = parameters[0];
|
std::string target = parameters[0];
|
||||||
if (parameters.size() >= 3)
|
if (parameters.size() > 1)
|
||||||
{
|
{
|
||||||
UserHostPair ih;
|
UserHostPair ih;
|
||||||
auto* find = ServerInstance->Users.Find(target, true);
|
auto* find = ServerInstance->Users.Find(target, true);
|
||||||
@ -72,25 +72,25 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long duration;
|
unsigned long duration = 0;
|
||||||
if (!Duration::TryFrom(parameters[1], duration))
|
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||||
{
|
{
|
||||||
user->WriteNotice("*** Invalid duration for K-line.");
|
user->WriteNotice("*** Invalid duration for K-line.");
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* kl = new KLine(ServerInstance->Time(), duration, user->nick, parameters[2], ih.first, ih.second);
|
auto* kl = new KLine(ServerInstance->Time(), duration, user->nick, parameters.back(), ih.first, ih.second);
|
||||||
if (ServerInstance->XLines->AddLine(kl, user))
|
if (ServerInstance->XLines->AddLine(kl, user))
|
||||||
{
|
{
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent K-line on {}: {}", user->nick, target, parameters[2]);
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent K-line on {}: {}",
|
||||||
|
user->nick, target, kl->reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed K-line on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed K-line on {}, expires in {} (on {}): {}",
|
||||||
user->nick, target, Duration::ToString(duration),
|
user->nick, target, Duration::ToString(duration), Time::FromNow(duration), kl->reason);
|
||||||
Time::FromNow(duration), parameters[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInstance->XLines->ApplyLines();
|
ServerInstance->XLines->ApplyLines();
|
||||||
|
@ -34,7 +34,7 @@ CommandQline::CommandQline(Module* parent)
|
|||||||
: Command(parent, "QLINE", 1, 3)
|
: Command(parent, "QLINE", 1, 3)
|
||||||
{
|
{
|
||||||
access_needed = CmdAccess::OPERATOR;
|
access_needed = CmdAccess::OPERATOR;
|
||||||
syntax = { "<nickmask>[,<nickmask>]+ [<duration> :<reason>]" };
|
syntax = { "<nickmask>[,<nickmask>]+ [[<duration>] :<reason>]" };
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdResult CommandQline::Handle(User* user, const Params& parameters)
|
CmdResult CommandQline::Handle(User* user, const Params& parameters)
|
||||||
@ -42,7 +42,7 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters)
|
|||||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
|
|
||||||
if (parameters.size() >= 3)
|
if (parameters.size() > 1)
|
||||||
{
|
{
|
||||||
NickMatcher matcher;
|
NickMatcher matcher;
|
||||||
if (InsaneBan::MatchesEveryone(parameters[0], matcher, user, 'Q', "nickmasks"))
|
if (InsaneBan::MatchesEveryone(parameters[0], matcher, user, 'Q', "nickmasks"))
|
||||||
@ -54,25 +54,25 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long duration;
|
unsigned long duration = 0;
|
||||||
if (!Duration::TryFrom(parameters[1], duration))
|
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||||
{
|
{
|
||||||
user->WriteNotice("*** Invalid duration for Q-line.");
|
user->WriteNotice("*** Invalid duration for Q-line.");
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* ql = new QLine(ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]);
|
auto* ql = new QLine(ServerInstance->Time(), duration, user->nick, parameters.back(), parameters[0]);
|
||||||
if (ServerInstance->XLines->AddLine(ql, user))
|
if (ServerInstance->XLines->AddLine(ql, user))
|
||||||
{
|
{
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Q-line on {}: {}", user->nick, parameters[0], parameters[2]);
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Q-line on {}: {}",
|
||||||
|
user->nick, parameters[0], ql->reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Q-line on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Q-line on {}, expires in {} (on {}): {}",
|
||||||
user->nick, parameters[0], Duration::ToString(duration),
|
user->nick, parameters[0], Duration::ToString(duration), Time::FromNow(duration), ql->reason);
|
||||||
Time::FromNow(duration), parameters[2]);
|
|
||||||
}
|
}
|
||||||
ServerInstance->XLines->ApplyLines();
|
ServerInstance->XLines->ApplyLines();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ CommandZline::CommandZline(Module* parent)
|
|||||||
: Command(parent, "ZLINE", 1, 3)
|
: Command(parent, "ZLINE", 1, 3)
|
||||||
{
|
{
|
||||||
access_needed = CmdAccess::OPERATOR;
|
access_needed = CmdAccess::OPERATOR;
|
||||||
syntax = { "<ipmask>[,<ipmask>]+ [<duration> :<reason>]" };
|
syntax = { "<ipmask>[,<ipmask>]+ [[<duration>] :<reason>]" };
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdResult CommandZline::Handle(User* user, const Params& parameters)
|
CmdResult CommandZline::Handle(User* user, const Params& parameters)
|
||||||
@ -44,7 +44,7 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters)
|
|||||||
return CmdResult::SUCCESS;
|
return CmdResult::SUCCESS;
|
||||||
|
|
||||||
std::string target = parameters[0];
|
std::string target = parameters[0];
|
||||||
if (parameters.size() >= 3)
|
if (parameters.size() > 1)
|
||||||
{
|
{
|
||||||
if (target.find('!') != std::string::npos)
|
if (target.find('!') != std::string::npos)
|
||||||
{
|
{
|
||||||
@ -71,25 +71,25 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters)
|
|||||||
if (InsaneBan::MatchesEveryone(ipaddr, matcher, user, 'Z', "ipmasks"))
|
if (InsaneBan::MatchesEveryone(ipaddr, matcher, user, 'Z', "ipmasks"))
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
|
|
||||||
unsigned long duration;
|
unsigned long duration = 0;
|
||||||
if (!Duration::TryFrom(parameters[1], duration))
|
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||||
{
|
{
|
||||||
user->WriteNotice("*** Invalid duration for Z-line.");
|
user->WriteNotice("*** Invalid duration for Z-line.");
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* zl = new ZLine(ServerInstance->Time(), duration, user->nick, parameters[2], ipaddr);
|
auto* zl = new ZLine(ServerInstance->Time(), duration, user->nick, parameters.back(), ipaddr);
|
||||||
if (ServerInstance->XLines->AddLine(zl, user))
|
if (ServerInstance->XLines->AddLine(zl, user))
|
||||||
{
|
{
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Z-line on {}: {}", user->nick, ipaddr, parameters[2]);
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent Z-line on {}: {}",
|
||||||
|
user->nick, ipaddr, zl->reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}",
|
||||||
user->nick, ipaddr, Duration::ToString(duration),
|
user->nick, ipaddr, Duration::ToString(duration), Time::FromNow(duration), zl->reason);
|
||||||
Time::FromNow(duration), parameters[2]);
|
|
||||||
}
|
}
|
||||||
ServerInstance->XLines->ApplyLines();
|
ServerInstance->XLines->ApplyLines();
|
||||||
}
|
}
|
||||||
|
@ -143,18 +143,18 @@ public:
|
|||||||
, factory(rlf)
|
, factory(rlf)
|
||||||
{
|
{
|
||||||
access_needed = CmdAccess::OPERATOR;
|
access_needed = CmdAccess::OPERATOR;
|
||||||
syntax = { "<regex> [<duration> :<reason>]" };
|
syntax = { "<regex> [[<duration>] :<reason>]" };
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdResult Handle(User* user, const Params& parameters) override
|
CmdResult Handle(User* user, const Params& parameters) override
|
||||||
{
|
{
|
||||||
|
|
||||||
if (parameters.size() >= 3)
|
if (parameters.size() > 1)
|
||||||
{
|
{
|
||||||
// Adding - XXX todo make this respect <insane> tag perhaps..
|
// Adding - XXX todo make this respect <insane> tag perhaps..
|
||||||
|
|
||||||
unsigned long duration;
|
unsigned long duration = 0;
|
||||||
if (!Duration::TryFrom(parameters[1], duration))
|
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||||
{
|
{
|
||||||
user->WriteNotice("*** Invalid duration for R-line.");
|
user->WriteNotice("*** Invalid duration for R-line.");
|
||||||
return CmdResult::FAILURE;
|
return CmdResult::FAILURE;
|
||||||
@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
r = factory.Generate(ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]);
|
r = factory.Generate(ServerInstance->Time(), duration, user->nick, parameters.back(), parameters[0]);
|
||||||
}
|
}
|
||||||
catch (const ModuleException& e)
|
catch (const ModuleException& e)
|
||||||
{
|
{
|
||||||
@ -176,13 +176,13 @@ public:
|
|||||||
{
|
{
|
||||||
if (!duration)
|
if (!duration)
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent R-line on {}: {}", user->nick, parameters[0], parameters[2]);
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent R-line on {}: {}",
|
||||||
|
user->nick, parameters[0], r->reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed R-line on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed R-line on {}, expires in {} (on {}): {}",
|
||||||
user->nick, parameters[0], Duration::ToString(duration),
|
user->nick, parameters[0], Duration::ToString(duration), Time::FromNow(duration), r->reason);
|
||||||
Time::FromNow(duration), parameters[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInstance->XLines->ApplyLines();
|
ServerInstance->XLines->ApplyLines();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user