mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-08 17:19:01 -05:00
Make /CBAN behave like documented.
This commit is contained in:
parent
6cb0f8a6d1
commit
b63a7a4d22
@ -571,7 +571,7 @@ Sends a message to all users with the +g snomask.
|
||||
">
|
||||
|
||||
<helptopic key="cban" title="/CBAN <channelmask> [<duration> [:<reason>]]" value="
|
||||
Sets or removes a global channel based ban. You must specify all three parameters
|
||||
Sets or removes a global channel based ban. You must specify two or more parameters
|
||||
to add a ban, and one parameter to remove a ban (just the channelmask).
|
||||
|
||||
The duration may be specified in seconds, or in the format
|
||||
|
@ -125,26 +125,25 @@ public:
|
||||
else
|
||||
{
|
||||
// Adding - XXX todo make this respect <insane> tag perhaps..
|
||||
unsigned long duration;
|
||||
if (!Duration::TryFrom(parameters[1], duration))
|
||||
unsigned long duration = 0;
|
||||
if (parameters.size() > 2 && !Duration::TryFrom(parameters[1], duration))
|
||||
{
|
||||
user->WriteNotice("*** Invalid duration for CBan.");
|
||||
return CmdResult::FAILURE;
|
||||
}
|
||||
|
||||
const char* reason = (parameters.size() > 2) ? parameters[2].c_str() : "No reason supplied";
|
||||
auto* r = new CBan(ServerInstance->Time(), duration, user->nick, reason, parameters[0]);
|
||||
auto* r = new CBan(ServerInstance->Time(), duration, user->nick, parameters.back(), parameters[0]);
|
||||
if (ServerInstance->XLines->AddLine(r, user))
|
||||
{
|
||||
if (!duration)
|
||||
{
|
||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent CBan on {}: {}", user->nick, parameters[0], reason);
|
||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a permanent CBan on {}: {}",
|
||||
user->nick, parameters[0], r->reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed CBan on {}, expires in {} (on {}): {}",
|
||||
user->nick, parameters[0], Duration::ToString(duration),
|
||||
Time::FromNow(duration), reason);
|
||||
user->nick, parameters[0], Duration::ToString(duration), Time::FromNow(duration), r->reason);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user