2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018 Matt Schatz <genius3000@g3k.solutions>
5 * Copyright (C) 2013, 2018 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2012-2013, 2016 Attila Molnar <attilamolnar@hush.com>
7 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
8 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
9 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
10 * Copyright (C) 2007, 2009 Dennis Friis <peavey@inspircd.org>
11 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
13 * This file is part of InspIRCd. InspIRCd is free software: you can
14 * redistribute it and/or modify it under the terms of the GNU General Public
15 * License as published by the Free Software Foundation, version 2.
17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 class CommandChgname : public Command
34 CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2)
36 allow_empty_last_param = false;
38 syntax = "<nick> :<realname>";
39 TRANSLATE2(TR_NICK, TR_TEXT);
42 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
44 User* dest = ServerInstance->FindNick(parameters[0]);
46 if ((!dest) || (dest->registered != REG_ALL))
48 user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
52 if (parameters[1].empty())
54 user->WriteNotice("*** CHGNAME: Real name must be specified");
58 if (parameters[1].length() > ServerInstance->Config->Limits.MaxReal)
60 user->WriteNotice("*** CHGNAME: Real name is too long");
66 dest->ChangeRealName(parameters[1]);
67 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());
73 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE
75 return ROUTE_OPT_UCAST(parameters[0]);
79 class ModuleChgName : public Module
84 ModuleChgName() : cmd(this)
88 Version GetVersion() CXX11_OVERRIDE
90 return Version("Adds the /CHGNAME command which allows server operators to change the real name (gecos) of a user.", VF_OPTCOMMON | VF_VENDOR);
94 MODULE_INIT(ModuleChgName)