]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_svshold.cpp
Improvements and bugfixes to the cgiirc module.
[user/henk/code/inspircd.git] / src / modules / m_svshold.cpp
index a623e1553746021fdd53fac731e71140897287ce..e74f3324ba936ff324326d4f94b86fbd273e5df8 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "inspircd.h"
 #include "xline.h"
+#include "modules/stats.h"
 
 namespace
 {
@@ -41,19 +42,19 @@ public:
                this->nickname = nick;
        }
 
-       bool Matches(User *u)
+       bool Matches(User* u) CXX11_OVERRIDE
        {
                if (u->nick == nickname)
                        return true;
                return false;
        }
 
-       bool Matches(const std::string &s)
+       bool Matches(const std::string& s) CXX11_OVERRIDE
        {
                return InspIRCd::Match(s, nickname);
        }
 
-       void DisplayExpiry()
+       void DisplayExpiry() CXX11_OVERRIDE
        {
                if (!silent)
                {
@@ -62,7 +63,7 @@ public:
                }
        }
 
-       const std::string& Displayable()
+       const std::string& Displayable() CXX11_OVERRIDE
        {
                return nickname;
        }
@@ -77,12 +78,12 @@ class SVSHoldFactory : public XLineFactory
 
        /** Generate a shun
        */
-       XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
+       XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) CXX11_OVERRIDE
        {
                return new SVSHold(set_time, duration, source, reason, xline_specific_mask);
        }
 
-       bool AutoApplyToUserList(XLine *x)
+       bool AutoApplyToUserList(XLine* x) CXX11_OVERRIDE
        {
                return false;
        }
@@ -98,7 +99,7 @@ class CommandSvshold : public Command
                flags_needed = 'o'; this->syntax = "<nickname> [<duration> :<reason>]";
        }
 
-       CmdResult Handle(const std::vector<std::string> &parameters, User *user)
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
        {
                /* syntax: svshold nickname time :reason goes here */
                /* 'time' is a human-readable timestring, like 2d3h2s. */
@@ -155,20 +156,22 @@ class CommandSvshold : public Command
                return CMD_SUCCESS;
        }
 
-       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE
        {
                return ROUTE_BROADCAST;
        }
 };
 
-class ModuleSVSHold : public Module
+class ModuleSVSHold : public Module, public Stats::EventListener
 {
        CommandSvshold cmd;
        SVSHoldFactory s;
 
 
  public:
-       ModuleSVSHold() : cmd(this)
+       ModuleSVSHold()
+               : Stats::EventListener(this)
+               , cmd(this)
        {
        }
 
@@ -183,12 +186,12 @@ class ModuleSVSHold : public Module
                silent = tag->getBool("silent", true);
        }
 
-       ModResult OnStats(char symbol, User* user, string_list &out) CXX11_OVERRIDE
+       ModResult OnStats(Stats::Context& stats) CXX11_OVERRIDE
        {
-               if(symbol != 'S')
+               if (stats.GetSymbol() != 'S')
                        return MOD_RES_PASSTHRU;
 
-               ServerInstance->XLines->InvokeStats("SVSHOLD", 210, user, out);
+               ServerInstance->XLines->InvokeStats("SVSHOLD", 210, stats);
                return MOD_RES_DENY;
        }
 
@@ -198,7 +201,7 @@ class ModuleSVSHold : public Module
 
                if (rl)
                {
-                       user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Services reserved nickname: %s", newnick.c_str(), rl->reason.c_str());
+                       user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, InspIRCd::Format("Services reserved nickname: %s", rl->reason.c_str()));
                        return MOD_RES_DENY;
                }