1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for SANICK command */
20 class CommandSanick : public Command
23 CommandSanick (InspIRCd* Instance) : Command(Instance,"SANICK", "o", 2, false, 0)
25 this->source = "m_sanick.so";
26 syntax = "<nick> <new-nick>";
27 TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
30 CmdResult Handle (const std::vector<std::string>& parameters, User *user)
32 User* target = ServerInstance->FindNick(parameters[0]);
35 if (ServerInstance->ULine(target->server))
37 user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
40 std::string oldnick = user->nick;
41 if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
43 user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
47 if (target->ForceNickChange(parameters[1].c_str()))
49 ServerInstance->SNO->WriteToSnoMask('A', oldnick+" used SANICK to change "+parameters[0]+" to "+parameters[1]);
54 /* We couldnt change the nick */
55 ServerInstance->SNO->WriteToSnoMask('A', oldnick+" failed SANICK (from "+parameters[0]+" to "+parameters[1]+")");
64 user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str());
72 class ModuleSanick : public Module
74 CommandSanick* mycommand;
76 ModuleSanick(InspIRCd* Me)
80 mycommand = new CommandSanick(ServerInstance);
81 ServerInstance->AddCommand(mycommand);
85 virtual ~ModuleSanick()
89 virtual Version GetVersion()
91 return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
96 MODULE_INIT(ModuleSanick)