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";
37 void Handle (char **parameters, int pcnt, userrec *user)
39 userrec* source = Srv->FindNick(std::string(parameters[0]));
42 if (Srv->IsNick(std::string(parameters[1])))
44 // FIX by brain: Cant use source->nick here because if it traverses a server link then
45 // source->nick becomes invalid as the object data moves in memory.
46 Srv->SendOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
47 Srv->ChangeUserNick(source,std::string(parameters[1]));
54 class ModuleSanick : public Module
56 cmd_sanick* mycommand;
58 ModuleSanick(Server* Me)
62 mycommand = new cmd_sanick();
63 Srv->AddCommand(mycommand);
66 virtual ~ModuleSanick()
70 virtual Version GetVersion()
72 return Version(1,0,0,1,VF_VENDOR);
77 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
79 class ModuleSanickFactory : public ModuleFactory
86 ~ModuleSanickFactory()
90 virtual Module * CreateModule(Server* Me)
92 return new ModuleSanick(Me);
98 extern "C" void * init_module( void )
100 return new ModuleSanickFactory;