1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
25 /* $ModDesc: Provides support for SANICK command */
29 class cmd_sanick : public command_t
32 cmd_sanick () : command_t("SANICK", 'o', 2)
34 this->source = "m_sanick.so";
35 syntax = "<nick> <new-nick>";
38 void Handle (const char** parameters, int pcnt, userrec *user)
40 userrec* source = Srv->FindNick(std::string(parameters[0]));
43 if (Srv->IsUlined(source->server))
45 WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
48 if (Srv->IsNick(std::string(parameters[1])))
50 // FIX by brain: Cant use source->nick here because if it traverses a server link then
51 // source->nick becomes invalid as the object data moves in memory.
52 Srv->SendOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
53 Srv->ChangeUserNick(source,std::string(parameters[1]));
60 class ModuleSanick : public Module
62 cmd_sanick* mycommand;
64 ModuleSanick(Server* Me)
68 mycommand = new cmd_sanick();
69 Srv->AddCommand(mycommand);
72 virtual ~ModuleSanick()
76 virtual Version GetVersion()
78 return Version(1,0,0,1,VF_VENDOR);
83 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
85 class ModuleSanickFactory : public ModuleFactory
92 ~ModuleSanickFactory()
96 virtual Module * CreateModule(Server* Me)
98 return new ModuleSanick(Me);
104 extern "C" void * init_module( void )
106 return new ModuleSanickFactory;