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 * ---------------------------------------------------
26 /* $ModDesc: Provides support for SANICK command */
31 class cmd_sanick : public command_t
34 cmd_sanick (InspIRCd* Instance) : command_t(Instance,"SANICK", 'o', 2)
36 this->source = "m_sanick.so";
37 syntax = "<nick> <new-nick>";
40 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
42 userrec* source = ServerInstance->FindNick(parameters[0]);
45 if (ServerInstance->ULine(source->server))
47 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
50 if (ServerInstance->IsNick(parameters[1]))
52 if (source->ForceNickChange(parameters[1]))
54 ServerInstance->WriteOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
59 /* We couldnt change the nick */
60 userrec::QuitUser(ServerInstance, source, "Nickname collision");
73 class ModuleSanick : public Module
75 cmd_sanick* mycommand;
77 ModuleSanick(InspIRCd* Me)
81 mycommand = new cmd_sanick(ServerInstance);
82 ServerInstance->AddCommand(mycommand);
85 virtual ~ModuleSanick()
89 virtual Version GetVersion()
91 return Version(1,0,0,1,VF_VENDOR);
96 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
98 class ModuleSanickFactory : public ModuleFactory
101 ModuleSanickFactory()
105 ~ModuleSanickFactory()
109 virtual Module * CreateModule(InspIRCd* Me)
111 return new ModuleSanick(Me);
117 extern "C" void * init_module( void )
119 return new ModuleSanickFactory;