1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 * ---------------------------------------------------
19 /* $ModDesc: Provides support for SANICK command */
23 class cmd_sanick : public command_t
26 cmd_sanick (InspIRCd* Instance) : command_t(Instance,"SANICK", 'o', 2)
28 this->source = "m_sanick.so";
29 syntax = "<nick> <new-nick>";
32 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
34 userrec* source = ServerInstance->FindNick(parameters[0]);
37 if (ServerInstance->ULine(source->server))
39 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
42 std::string oldnick = user->nick;
43 if (ServerInstance->IsNick(parameters[1]))
45 if (source->ForceNickChange(parameters[1]))
47 ServerInstance->WriteOpers("*** " + oldnick+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
52 /* We couldnt change the nick */
53 ServerInstance->WriteOpers("*** " + oldnick+" failed SANICK (from "+std::string(parameters[0])+" to "+parameters[1]+")");
59 user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[1]);
66 user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick, parameters[0]);
74 class ModuleSanick : public Module
76 cmd_sanick* mycommand;
78 ModuleSanick(InspIRCd* Me)
82 mycommand = new cmd_sanick(ServerInstance);
83 ServerInstance->AddCommand(mycommand);
86 virtual ~ModuleSanick()
90 virtual Version GetVersion()
92 return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
97 MODULE_INIT(ModuleSanick)