aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_repeat.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2019-07-16 15:11:21 +0100
committerGravatar Sadie Powell2019-07-16 16:48:18 +0100
commitcd8b456f979733525941284639d8bf899173b429 (patch)
treef1d26962e61c74c5acb076662a909beafbe8e5fd /src/modules/m_repeat.cpp
parentReplace socketengine_{pthread,win32} with C++11 threads. (diff)
parentssl_gnutls: remove PackageInfo directives for EOL Debian versions. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_repeat.cpp')
-rw-r--r--src/modules/m_repeat.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp
index 253d0a3a4..b9b363cbb 100644
--- a/src/modules/m_repeat.cpp
+++ b/src/modules/m_repeat.cpp
@@ -125,6 +125,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
: ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >(Creator, "repeat", 'E')
, MemberInfoExt("repeat_memb", ExtensionItem::EXT_MEMBERSHIP, Creator)
{
+ syntax = "[~|*]<lines>:<sec>[:<difference>][:<backlog>]";
}
void OnUnset(User* source, Channel* chan) override
@@ -140,15 +141,14 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
ChannelSettings settings;
if (!ParseSettings(source, parameter, settings))
{
- source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
- "Invalid repeat syntax. Syntax is: [~|*]<lines>:<sec>[:<difference>][:<backlog>]"));
+ source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter));
return MODEACTION_DENY;
}
if ((settings.Backlog > 0) && (settings.Lines > settings.Backlog))
{
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
- "Invalid repeat syntax. You can't set lines higher than backlog."));
+ "You can't set lines higher than backlog."));
return MODEACTION_DENY;
}
@@ -277,10 +277,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
if ((settings.Lines = ConvToNum<unsigned int>(item)) == 0)
return false;
- if (!InspIRCd::Duration(item, settings.Seconds))
- return false;
-
- if ((!stream.GetToken(item)) || (settings.Seconds == 0))
+ if ((!stream.GetToken(item)) || !InspIRCd::Duration(item, settings.Seconds) || (settings.Seconds == 0))
// Required parameter missing
return false;
@@ -312,14 +309,14 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
if (ms.MaxLines && settings.Lines > ms.MaxLines)
{
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
- "Invalid repeat parameter. The line number you specified is too great. Maximum allowed is %u.", ms.MaxLines)));
+ "The line number you specified is too big. Maximum allowed is %u.", ms.MaxLines)));
return false;
}
if (ms.MaxSecs && settings.Seconds > ms.MaxSecs)
{
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
- "Invalid repeat parameter. The seconds you specified are too great. Maximum allowed is %u.", ms.MaxSecs)));
+ "The seconds you specified are too big. Maximum allowed is %u.", ms.MaxSecs)));
return false;
}
@@ -327,10 +324,10 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
{
if (ms.MaxDiff == 0)
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
- "Invalid repeat parameter. The server administrator has disabled matching on edit distance."));
+ "The server administrator has disabled matching on edit distance."));
else
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
- "Invalid repeat parameter. The distance you specified is too great. Maximum allowed is %u.", ms.MaxDiff)));
+ "The distance you specified is too big. Maximum allowed is %u.", ms.MaxDiff)));
return false;
}
@@ -338,10 +335,10 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
{
if (ms.MaxBacklog == 0)
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
- "Invalid repeat parameter. The server administrator has disabled backlog matching."));
+ "The server administrator has disabled backlog matching."));
else
source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
- "Invalid repeat paramter. The backlog you specified is too great. Maximum allowed is %u.", ms.MaxBacklog)));
+ "The backlog you specified is too big. Maximum allowed is %u.", ms.MaxBacklog)));
return false;
}