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 */
30 class cmd_sanick : public command_t
33 cmd_sanick (InspIRCd* Instance) : command_t(Instance,"SANICK", 'o', 2)
35 this->source = "m_sanick.so";
36 syntax = "<nick> <new-nick>";
39 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
41 userrec* source = ServerInstance->FindNick(parameters[0]);
44 if (ServerInstance->ULine(source->server))
46 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
49 std::string oldnick = user->nick;
50 if (ServerInstance->IsNick(parameters[1]))
52 if (source->ForceNickChange(parameters[1]))
54 ServerInstance->WriteOpers(oldnick+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
59 /* We couldnt change the nick */
60 ServerInstance->WriteOpers(oldnick+" failed SANICK (from "+std::string(parameters[0])+" to "+parameters[1]+")");
66 user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[1]);
77 class ModuleSanick : public Module
79 cmd_sanick* mycommand;
81 ModuleSanick(InspIRCd* Me)
85 mycommand = new cmd_sanick(ServerInstance);
86 ServerInstance->AddCommand(mycommand);
89 virtual ~ModuleSanick()
93 virtual Version GetVersion()
95 return Version(1,0,0,1,VF_VENDOR,API_VERSION);
100 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
102 class ModuleSanickFactory : public ModuleFactory
105 ModuleSanickFactory()
109 ~ModuleSanickFactory()
113 virtual Module * CreateModule(InspIRCd* Me)
115 return new ModuleSanick(Me);
121 extern "C" void * init_module( void )
123 return new ModuleSanickFactory;