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 (const char** parameters, int pcnt, userrec *user)
39 userrec* source = Srv->FindNick(std::string(parameters[0]));
42 if (Srv->IsUlined(source->server))
44 WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
47 if (Srv->IsNick(std::string(parameters[1])))
49 // FIX by brain: Cant use source->nick here because if it traverses a server link then
50 // source->nick becomes invalid as the object data moves in memory.
51 Srv->SendOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
52 Srv->ChangeUserNick(source,std::string(parameters[1]));
59 class ModuleSanick : public Module
61 cmd_sanick* mycommand;
63 ModuleSanick(Server* Me)
67 mycommand = new cmd_sanick();
68 Srv->AddCommand(mycommand);
71 virtual ~ModuleSanick()
75 virtual Version GetVersion()
77 return Version(1,0,0,1,VF_VENDOR);
82 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
84 class ModuleSanickFactory : public ModuleFactory
91 ~ModuleSanickFactory()
95 virtual Module * CreateModule(Server* Me)
97 return new ModuleSanick(Me);
103 extern "C" void * init_module( void )
105 return new ModuleSanickFactory;