]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_setident.cpp
Some more text fixes and improvements (#1618).
[user/henk/code/inspircd.git] / src / modules / m_setident.cpp
index 534742097be4f8ca849b561a1df49e5fe37f9a85..04b5c97c858a440ac5e9c49f872af1d40081cf86 100644 (file)
@@ -22,8 +22,6 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Provides support for the SETIDENT command */
-
 /** Handle /SETIDENT
  */
 class CommandSetident : public Command
@@ -31,38 +29,31 @@ class CommandSetident : public Command
  public:
  CommandSetident(Module* Creator) : Command(Creator,"SETIDENT", 1)
        {
-               flags_needed = 'o'; syntax = "<new-ident>";
-               TRANSLATE2(TR_TEXT, TR_END);
+               allow_empty_last_param = false;
+               flags_needed = 'o'; syntax = "<ident>";
        }
 
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user)
+       CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
        {
-               if (parameters.size() == 0)
-               {
-                       user->WriteServ("NOTICE %s :*** SETIDENT: Ident must be specified", user->nick.c_str());
-                       return CMD_FAILURE;
-               }
-
                if (parameters[0].size() > ServerInstance->Config->Limits.IdentMax)
                {
-                       user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick.c_str());
+                       user->WriteNotice("*** SETIDENT: Ident is too long");
                        return CMD_FAILURE;
                }
 
-               if (!ServerInstance->IsIdent(parameters[0].c_str()))
+               if (!ServerInstance->IsIdent(parameters[0]))
                {
-                       user->WriteServ("NOTICE %s :*** SETIDENT: Invalid characters in ident", user->nick.c_str());
+                       user->WriteNotice("*** SETIDENT: Invalid characters in ident");
                        return CMD_FAILURE;
                }
 
-               user->ChangeIdent(parameters[0].c_str());
+               user->ChangeIdent(parameters[0]);
                ServerInstance->SNO->WriteGlobalSno('a', "%s used SETIDENT to change their ident to '%s'", user->nick.c_str(), user->ident.c_str());
 
                return CMD_SUCCESS;
        }
 };
 
-
 class ModuleSetIdent : public Module
 {
        CommandSetident cmd;
@@ -72,21 +63,10 @@ class ModuleSetIdent : public Module
        {
        }
 
-       void init()
-       {
-               ServerInstance->Modules->AddService(cmd);
-       }
-
-       virtual ~ModuleSetIdent()
+       Version GetVersion() CXX11_OVERRIDE
        {
+               return Version("Provides the SETIDENT command", VF_VENDOR);
        }
-
-       virtual Version GetVersion()
-       {
-               return Version("Provides support for the SETIDENT command", VF_VENDOR);
-       }
-
 };
 
-
 MODULE_INIT(ModuleSetIdent)