1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
21 /* $ModDesc: Provides support for SANICK command */
25 class cmd_sanick : public command_t
28 cmd_sanick (InspIRCd* Instance) : command_t(Instance,"SANICK", 'o', 2)
30 this->source = "m_sanick.so";
31 syntax = "<nick> <new-nick>";
34 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
36 userrec* source = ServerInstance->FindNick(parameters[0]);
39 if (ServerInstance->ULine(source->server))
41 user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
44 std::string oldnick = user->nick;
45 if (ServerInstance->IsNick(parameters[1]))
47 if (source->ForceNickChange(parameters[1]))
49 ServerInstance->WriteOpers(oldnick+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
54 /* We couldnt change the nick */
55 ServerInstance->WriteOpers(oldnick+" failed SANICK (from "+std::string(parameters[0])+" to "+parameters[1]+")");
61 user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[1]);
68 user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick, parameters[0]);
76 class ModuleSanick : public Module
78 cmd_sanick* mycommand;
80 ModuleSanick(InspIRCd* Me)
84 mycommand = new cmd_sanick(ServerInstance);
85 ServerInstance->AddCommand(mycommand);
88 virtual ~ModuleSanick()
92 virtual Version GetVersion()
94 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
99 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
101 class ModuleSanickFactory : public ModuleFactory
104 ModuleSanickFactory()
108 ~ModuleSanickFactory()
112 virtual Module * CreateModule(InspIRCd* Me)
114 return new ModuleSanick(Me);
120 extern "C" void * init_module( void )
122 return new ModuleSanickFactory;