X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_setident.cpp;h=3d0031e27de7bb6fef5e6941816766244d02a5ab;hb=3151d60c1ecc9462e4c335282ee6c31672f45111;hp=2e81c1efd063138c7fcee3f7df07304b83976bf4;hpb=553a8da754c8cd308bad2008018849714e70f9b7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 2e81c1efd..3d0031e27 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -1,10 +1,14 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2007 Dennis Friis - * Copyright (C) 2007 John Brooks + * Copyright (C) 2013, 2018, 2020 Sadie Powell + * Copyright (C) 2012-2013 Attila Molnar + * Copyright (C) 2012, 2019 Robby + * Copyright (C) 2009 Uli Schlachter + * Copyright (C) 2009 Daniel De Graaf * Copyright (C) 2007 Robin Burchell - * Copyright (C) 2006 Oliver Lupton + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006, 2008 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -22,8 +26,6 @@ #include "inspircd.h" -/* $ModDesc: Provides support for the SETIDENT command */ - /** Handle /SETIDENT */ class CommandSetident : public Command @@ -31,58 +33,45 @@ class CommandSetident : public Command public: CommandSetident(Module* Creator) : Command(Creator,"SETIDENT", 1) { - flags_needed = 'o'; syntax = ""; - TRANSLATE2(TR_TEXT, TR_END); + allow_empty_last_param = false; + flags_needed = 'o'; + syntax = ""; } - CmdResult Handle(const std::vector& 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; 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); + return Version("Adds the /SETIDENT command which allows server operators to change their username (ident).", VF_VENDOR); } - }; - MODULE_INIT(ModuleSetIdent)