]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_timedbans.cpp
Some more text fixes and improvements (#1618).
[user/henk/code/inspircd.git] / src / modules / m_timedbans.cpp
index 058028f61aa96997da25da5ae3f19778164e4472..a17d3111671b14aaed29e6317bf204419170ffc8 100644 (file)
@@ -84,13 +84,13 @@ class CommandTban : public Command
                }
 
                TimedBan T;
-               unsigned long duration = InspIRCd::Duration(parameters[1]);
-               unsigned long expire = duration + ServerInstance->Time();
-               if (duration < 1)
+               unsigned long duration;
+               if (!InspIRCd::Duration(parameters[1], duration))
                {
                        user->WriteNotice("Invalid ban time");
                        return CMD_FAILURE;
                }
+               unsigned long expire = duration + ServerInstance->Time();
                std::string mask = parameters[2];
                bool isextban = ((mask.size() > 2) && (mask[1] == ':'));
                if (!isextban && !InspIRCd::IsValidMask(mask))
@@ -118,7 +118,7 @@ class CommandTban : public Command
                T.chan = channel;
                TimedBanList.push_back(T);
 
-               const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds.";
+               const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + InspIRCd::DurationString(duration) + ".";
                // If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
                PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
                char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
@@ -234,7 +234,7 @@ class ModuleTimedBans : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Adds timed bans", VF_COMMON | VF_VENDOR);
+               return Version("Provides the TBAN command, timed channel bans", VF_COMMON | VF_VENDOR);
        }
 };