X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nicklock.cpp;h=a6178fc5a9fd61ca881461ee09551ad284ce532d;hb=4ab1c43c1eee708fc50a4808f714a731891b75e8;hp=e088c12daba9395d280a3ed0728654daa9cca83c;hpb=44f42a13de52c8025942ddab42f51feb36821782;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index e088c12da..a6178fc5a 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -22,7 +22,7 @@ #include "inspircd.h" -/* $ModDesc: Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit */ +/* $ModDesc: Provides the NICKLOCK command, allows an oper to change a users nick and lock them to it until they quit */ /** Handle /NICKLOCK */ @@ -42,18 +42,18 @@ class CommandNicklock : public Command { User* target = ServerInstance->FindNick(parameters[0]); - if (!target) + if ((!target) || (target->registered != REG_ALL)) { - user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str()); + user->WriteNotice("*** No such nickname: '" + parameters[0] + "'"); return CMD_FAILURE; } /* Do local sanity checks and bails */ if (IS_LOCAL(user)) { - if (!ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax)) + if (!ServerInstance->IsNick(parameters[1], ServerInstance->Config->Limits.NickMax)) { - user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str()); + user->WriteNotice("*** Invalid nickname '" + parameters[1] + "'"); return CMD_FAILURE; } @@ -107,7 +107,7 @@ class CommandNickunlock : public Command if (!target) { - user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str()); + user->WriteNotice("*** No such nickname: '" + parameters[0] + "'"); return CMD_FAILURE; } @@ -139,7 +139,6 @@ class CommandNickunlock : public Command } }; - class ModuleNickLock : public Module { LocalIntExt locked; @@ -149,22 +148,22 @@ class ModuleNickLock : public Module ModuleNickLock() : locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) { - ServerInstance->AddCommand(&cmd1); - ServerInstance->AddCommand(&cmd2); - ServerInstance->Extensions.Register(&locked); - ServerInstance->Modules->Attach(I_OnUserPreNick, this); } - ~ModuleNickLock() + void init() CXX11_OVERRIDE { + ServerInstance->Modules->AddService(cmd1); + ServerInstance->Modules->AddService(cmd2); + ServerInstance->Modules->AddService(locked); + ServerInstance->Modules->Attach(I_OnUserPreNick, this); } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { - return Version("Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit", VF_OPTCOMMON | VF_VENDOR); + return Version("Provides the NICKLOCK command, allows an oper to change a users nick and lock them to it until they quit", VF_OPTCOMMON | VF_VENDOR); } - ModResult OnUserPreNick(User* user, const std::string &newnick) + ModResult OnUserPreNick(User* user, const std::string &newnick) CXX11_OVERRIDE { if (!IS_LOCAL(user)) return MOD_RES_PASSTHRU;