X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chgname.cpp;h=fa25c52a00bbe5f337d83553f4e9062d0dbc71c4;hb=fd1d19d6345943ecdb5ce4ef947f9b3c5c8bca86;hp=2ac24c5d512bc2e90a3bb8da332a5e8b95a4c4ae;hpb=74ee9af96639323d852a8b15be72ee9974e0a826;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 2ac24c5d5..fa25c52a0 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -20,8 +20,6 @@ #include "inspircd.h" -/* $ModDesc: Provides support for the CHGNAME command */ - /** Handle /CHGNAME */ class CommandChgname : public Command @@ -29,16 +27,17 @@ class CommandChgname : public Command public: CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2) { + allow_empty_last_param = false; flags_needed = 'o'; syntax = " "; - TRANSLATE3(TR_NICK, TR_TEXT, TR_END); + TRANSLATE2(TR_NICK, TR_TEXT); } CmdResult Handle(const std::vector ¶meters, User *user) { User* dest = ServerInstance->FindNick(parameters[0]); - if (!dest) + if ((!dest) || (dest->registered != REG_ALL)) { user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; @@ -46,13 +45,13 @@ class CommandChgname : public Command if (parameters[1].empty()) { - user->WriteServ("NOTICE %s :*** CHGNAME: GECOS must be specified", user->nick.c_str()); + user->WriteNotice("*** CHGNAME: GECOS must be specified"); return CMD_FAILURE; } if (parameters[1].length() > ServerInstance->Config->Limits.MaxGecos) { - user->WriteServ("NOTICE %s :*** CHGNAME: GECOS too long", user->nick.c_str()); + user->WriteNotice("*** CHGNAME: GECOS too long"); return CMD_FAILURE; } @@ -74,7 +73,6 @@ class CommandChgname : public Command } }; - class ModuleChgName : public Module { CommandChgname cmd; @@ -82,14 +80,14 @@ class ModuleChgName : public Module public: ModuleChgName() : cmd(this) { - ServerInstance->AddCommand(&cmd); } - virtual ~ModuleChgName() + void init() CXX11_OVERRIDE { + ServerInstance->Modules->AddService(cmd); } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides support for the CHGNAME command", VF_OPTCOMMON | VF_VENDOR); }