X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_setident.cpp;h=93dd4c332bb2f97a4c1cd158feb5c3091562ea8d;hb=f9fd78c01623514a060c607534fc52cb73140200;hp=2e81c1efd063138c7fcee3f7df07304b83976bf4;hpb=44f42a13de52c8025942ddab42f51feb36821782;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 2e81c1efd..93dd4c332 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -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) { + allow_empty_last_param = false; flags_needed = 'o'; syntax = ""; - TRANSLATE2(TR_TEXT, TR_END); } CmdResult Handle(const std::vector& parameters, User *user) { - 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; @@ -70,19 +61,12 @@ class ModuleSetIdent : public Module public: ModuleSetIdent() : cmd(this) { - ServerInstance->AddCommand(&cmd); } - virtual ~ModuleSetIdent() - { - } - - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides support for the SETIDENT command", VF_VENDOR); } - }; - MODULE_INIT(ModuleSetIdent)