1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 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 void handle_sanick(char **parameters, int pcnt, userrec *user)
31 userrec* source = Srv->FindNick(std::string(parameters[0]));
34 if (Srv->IsNick(std::string(parameters[1])))
36 // FIX by brain: Cant use source->nick here because if it traverses a server link then
37 // source->nick becomes invalid as the object data moves in memory.
38 Srv->SendOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
39 Srv->ChangeUserNick(source,std::string(parameters[1]));
45 class ModuleSanick : public Module
51 Srv->AddCommand("SANICK",handle_sanick,'o',2,"m_sanick.so");
54 virtual ~ModuleSanick()
59 virtual Version GetVersion()
61 return Version(1,0,0,1,VF_VENDOR);
66 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
68 class ModuleSanickFactory : public ModuleFactory
75 ~ModuleSanickFactory()
79 virtual Module * CreateModule()
81 return new ModuleSanick;
87 extern "C" void * init_module( void )
89 return new ModuleSanickFactory;