]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_repeat.cpp
Some more text fixes and improvements (#1618).
[user/henk/code/inspircd.git] / src / modules / m_repeat.cpp
index af69f6be1ec69f5e2350e5c4466cd0cc246422d0..609fd9d60d36c258359c3250bde9c07e6aca8aa2 100644 (file)
@@ -34,7 +34,7 @@ class ChannelSettings
        unsigned int Backlog;
        unsigned int Lines;
        unsigned int Diff;
-       unsigned int Seconds;
+       unsigned long Seconds;
 
        void serialize(std::string& out) const
        {
@@ -127,7 +127,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
        {
        }
 
-       void OnUnset(User* source, Channel* chan)
+       void OnUnset(User* source, Channel* chan) CXX11_OVERRIDE
        {
                // Unset the per-membership extension when the mode is removed
                const Channel::MemberMap& users = chan->GetUsers();
@@ -141,14 +141,14 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                if (!ParseSettings(source, parameter, settings))
                {
                        source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter,
-                               "Invalid repeat syntax. Syntax is {[~*]}[lines]:[time]{:[difference]}{:[backlog]}."));
+                               "Invalid repeat syntax. Syntax is: [~|*]<lines>:<sec>[:<difference>][:<backlog>]"));
                        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 needed lines higher than backlog."));
+                               "Invalid repeat syntax. You can't set lines higher than backlog."));
                        return MODEACTION_DENY;
                }
 
@@ -277,7 +277,10 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                if ((settings.Lines = ConvToNum<unsigned int>(item)) == 0)
                        return false;
 
-               if ((!stream.GetToken(item)) || ((settings.Seconds = InspIRCd::Duration(item)) == 0))
+               if (!InspIRCd::Duration(item, settings.Seconds))
+                       return false;
+
+               if ((!stream.GetToken(item)) || (settings.Seconds == 0))
                        // Required parameter missing
                        return false;
 
@@ -316,7 +319,7 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                if (ms.MaxSecs && settings.Seconds > ms.MaxSecs)
                {
                        source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, InspIRCd::Format(
-                               "Invalid repeat parameter. The seconds you specified is too great. Maximum allowed is %u.", ms.MaxSecs)));
+                               "Invalid repeat parameter. The seconds you specified are too great. Maximum allowed is %u.", ms.MaxSecs)));
                        return false;
                }
 
@@ -409,7 +412,7 @@ class RepeatModule : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides the +E channel mode - for blocking of similar messages", VF_COMMON|VF_VENDOR, rm.GetModuleSettings());
+               return Version("Provides channel mode +E, blocking of similar messages", VF_COMMON|VF_VENDOR, rm.GetModuleSettings());
        }
 };