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 if (!source->ForceNickChange(parameters[1]))
55 /* We couldnt change the nick */
56 userrec::QuitUser(source, "Nickname collision");
65 class ModuleSanick : public Module
67 cmd_sanick* mycommand;
69 ModuleSanick(Server* Me)
73 mycommand = new cmd_sanick();
74 Srv->AddCommand(mycommand);
77 virtual ~ModuleSanick()
81 virtual Version GetVersion()
83 return Version(1,0,0,1,VF_VENDOR);
88 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
90 class ModuleSanickFactory : public ModuleFactory
97 ~ModuleSanickFactory()
101 virtual Module * CreateModule(Server* Me)
103 return new ModuleSanick(Me);
109 extern "C" void * init_module( void )
111 return new ModuleSanickFactory;