]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_saquit.cpp
Convert WriteNumeric() calls to pass the parameters of the numeric as method parameters
[user/henk/code/inspircd.git] / src / modules / m_saquit.cpp
index eae832ccbbb1e249b2ddd18cfb0cd72ae5cc063b..4d5ac6e22a985904306ad6343e938384b1effe50 100644 (file)
@@ -21,8 +21,6 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */
-
 /** Handle /SAQUIT
  */
 class CommandSaquit : public Command
@@ -31,32 +29,32 @@ class CommandSaquit : public Command
        CommandSaquit(Module* Creator) : Command(Creator, "SAQUIT", 2, 2)
        {
                flags_needed = 'o'; Penalty = 0; syntax = "<nick> <reason>";
-               TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
+               TRANSLATE2(TR_NICK, TR_TEXT);
        }
 
        CmdResult Handle (const std::vector<std::string>& parameters, User *user)
        {
                User* dest = ServerInstance->FindNick(parameters[0]);
-               if (dest)
+               if ((dest) && (dest->registered == REG_ALL))
                {
-                       if (ServerInstance->ULine(dest->server))
+                       if (dest->server->IsULine())
                        {
-                               user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
+                               user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client");
                                return CMD_FAILURE;
                        }
 
                        // Pass the command on, so the client's server can quit it properly.
                        if (!IS_LOCAL(dest))
                                return CMD_SUCCESS;
-                       
-                       ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+parameters[1]);
+
+                       ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAQUIT to make "+dest->nick+" quit with a reason of "+parameters[1]);
 
                        ServerInstance->Users->QuitUser(dest, parameters[1]);
                        return CMD_SUCCESS;
                }
                else
                {
-                       user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[0].c_str());
+                       user->WriteNotice("*** Invalid nickname '" + parameters[0] + "'");
                        return CMD_FAILURE;
                }
        }
@@ -77,18 +75,12 @@ class ModuleSaquit : public Module
        ModuleSaquit()
                : cmd(this)
        {
-               ServerInstance->AddCommand(&cmd);
        }
 
-       virtual ~ModuleSaquit()
-       {
-       }
-
-       virtual Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides support for an SAQUIT command, exits user with a reason", VF_OPTCOMMON | VF_VENDOR);
        }
-
 };
 
 MODULE_INIT(ModuleSaquit)