2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
5 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
7 * This file is part of InspIRCd. InspIRCd is free software: you can
8 * redistribute it and/or modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation, version 2.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 class CommandChgname : public Command
28 CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2)
30 allow_empty_last_param = false;
32 syntax = "<nick> <new real name>";
33 TRANSLATE2(TR_NICK, TR_TEXT);
36 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
38 User* dest = ServerInstance->FindNick(parameters[0]);
40 if ((!dest) || (dest->registered != REG_ALL))
42 user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
46 if (parameters[1].empty())
48 user->WriteNotice("*** CHGNAME: Real name must be specified");
52 if (parameters[1].length() > ServerInstance->Config->Limits.MaxReal)
54 user->WriteNotice("*** CHGNAME: Real name is too long");
60 dest->ChangeRealName(parameters[1]);
61 ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->GetRealName().c_str());
67 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE
69 return ROUTE_OPT_UCAST(parameters[0]);
73 class ModuleChgName : public Module
78 ModuleChgName() : cmd(this)
82 Version GetVersion() CXX11_OVERRIDE
84 return Version("Provides support for the CHGNAME command", VF_OPTCOMMON | VF_VENDOR);
88 MODULE_INIT(ModuleChgName)