]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_svshold.cpp
Move ident lookups to the OnSetUserIP hook.
[user/henk/code/inspircd.git] / src / modules / m_svshold.cpp
index e74f3324ba936ff324326d4f94b86fbd273e5df8..0aaf113f0a21f58cbebe5f1e8a252099b3266d4e 100644 (file)
@@ -36,7 +36,7 @@ class SVSHold : public XLine
 public:
        std::string nickname;
 
-       SVSHold(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& nick)
+       SVSHold(time_t s_time, unsigned long d, const std::string& src, const std::string& re, const std::string& nick)
                : XLine(s_time, d, src, re, "SVSHOLD")
        {
                this->nickname = nick;
@@ -58,8 +58,8 @@ public:
        {
                if (!silent)
                {
-                       ServerInstance->SNO->WriteToSnoMask('x', "Removing expired SVSHOLD %s (set by %s %ld seconds ago)",
-                               nickname.c_str(), source.c_str(), (long)(ServerInstance->Time() - set_time));
+                       ServerInstance->SNO->WriteToSnoMask('x', "Removing expired SVSHOLD %s (set by %s %ld seconds ago): %s",
+                               nickname.c_str(), source.c_str(), (long)(ServerInstance->Time() - set_time), reason.c_str());
                }
        }
 
@@ -76,9 +76,9 @@ class SVSHoldFactory : public XLineFactory
  public:
        SVSHoldFactory() : XLineFactory("SVSHOLD") { }
 
-       /** Generate a shun
+       /** Generate an SVSHOLD
        */
-       XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) CXX11_OVERRIDE
+       XLine* Generate(time_t set_time, unsigned long duration, const std::string& source, const std::string& reason, const std::string& xline_specific_mask) CXX11_OVERRIDE
        {
                return new SVSHold(set_time, duration, source, reason, xline_specific_mask);
        }
@@ -127,7 +127,12 @@ class CommandSvshold : public Command
                        if (parameters.size() < 3)
                                return CMD_FAILURE;
 
-                       unsigned long duration = InspIRCd::Duration(parameters[1]);
+                       unsigned long duration;
+                       if (!InspIRCd::Duration(parameters[1], duration))
+                       {
+                               user->WriteNotice("*** Invalid duration for SVSHOLD.");
+                               return CMD_FAILURE;
+                       }
                        SVSHold* r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str());
 
                        if (ServerInstance->XLines->AddLine(r, user))
@@ -216,7 +221,7 @@ class ModuleSVSHold : public Module, public Stats::EventListener
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Implements SVSHOLD. Like Q:Lines, but can only be added/removed by Services.", VF_COMMON | VF_VENDOR);
+               return Version("Implements SVSHOLD. Like Q-lines, but can only be added/removed by Services.", VF_COMMON | VF_VENDOR);
        }
 };