mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04: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="
|
<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).
|
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
|
The duration may be specified in seconds, or in the format
|
||||||
|
@ -125,26 +125,25 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 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 CBan.");
|
user->WriteNotice("*** Invalid duration for CBan.");
|
||||||
return CmdResult::FAILURE;
|
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, parameters.back(), parameters[0]);
|
||||||
auto* r = new CBan(ServerInstance->Time(), duration, user->nick, reason, parameters[0]);
|
|
||||||
if (ServerInstance->XLines->AddLine(r, user))
|
if (ServerInstance->XLines->AddLine(r, user))
|
||||||
{
|
{
|
||||||
if (!duration)
|
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
|
else
|
||||||
{
|
{
|
||||||
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed CBan on {}, expires in {} (on {}): {}",
|
ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed CBan 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), reason);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user