]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_repeat.cpp
m_check: Fix showing oper permissions (privileges). (#1556)
[user/henk/code/inspircd.git] / src / modules / m_repeat.cpp
index 18732d705de52952fe1d0021928a3c149f31a07b..a8dd49e2de1400280c2ccd882a68f68f492fafd7 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();
@@ -233,15 +233,15 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
        void ReadConfig()
        {
                ConfigTag* conf = ServerInstance->Config->ConfValue("repeat");
-               ms.MaxLines = conf->getInt("maxlines", 20);
-               ms.MaxBacklog = conf->getInt("maxbacklog", 20);
+               ms.MaxLines = conf->getUInt("maxlines", 20);
+               ms.MaxBacklog = conf->getUInt("maxbacklog", 20);
                ms.MaxSecs = conf->getDuration("maxtime", conf->getDuration("maxsecs", 0));
 
-               ms.MaxDiff = conf->getInt("maxdistance", 50);
+               ms.MaxDiff = conf->getUInt("maxdistance", 50);
                if (ms.MaxDiff > 100)
                        ms.MaxDiff = 100;
 
-               unsigned int newsize = conf->getInt("size", 512);
+               unsigned int newsize = conf->getUInt("size", 512);
                if (newsize > ServerInstance->Config->Limits.MaxLine)
                        newsize = ServerInstance->Config->Limits.MaxLine;
                Resize(newsize);
@@ -274,10 +274,13 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                else
                        settings.Action = ChannelSettings::ACT_KICK;
 
-               if ((settings.Lines = ConvToInt(item)) == 0)
+               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;
 
@@ -286,13 +289,13 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> >
                if (stream.GetToken(item))
                {
                        // There is a diff parameter, see if it's valid (> 0)
-                       if ((settings.Diff = ConvToInt(item)) == 0)
+                       if ((settings.Diff = ConvToNum<unsigned int>(item)) == 0)
                                return false;
 
                        if (stream.GetToken(item))
                        {
                                // There is a backlog parameter, see if it's valid
-                               if ((settings.Backlog = ConvToInt(item)) == 0)
+                               if ((settings.Backlog = ConvToNum<unsigned int>(item)) == 0)
                                        return false;
 
                                // If there are still tokens, then it's invalid because we allow only 4