diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-16 18:23:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-16 18:23:50 +0000 |
commit | ab9d8fd1af3ebf028506ec543f74fd13471742dd (patch) | |
tree | d95fd9303718109daa304bd602dc69af1ebb1b05 /src/modules/m_sanick.cpp | |
parent | 293df6a8b55e89c127e60e92711ef0ef1027bff8 (diff) |
Porting to new command system
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2535 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_sanick.cpp')
-rw-r--r-- | src/modules/m_sanick.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 056ccafd2..7146eb262 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -25,31 +25,42 @@ using namespace std; /* $ModDesc: Provides support for SANICK command */ Server *Srv; - -void handle_sanick(char **parameters, int pcnt, userrec *user) + +class cmd_sanick : public command_t { - userrec* source = Srv->FindNick(std::string(parameters[0])); - if (source) + public: + cmd_sanick () : command_t("SANICK", 'o', 2) { - if (Srv->IsNick(std::string(parameters[1]))) + this->source = "m_sanick.so"; + } + + void Handle (char **parameters, int pcnt, userrec *user) + { + userrec* source = Srv->FindNick(std::string(parameters[0])); + if (source) { - // FIX by brain: Cant use source->nick here because if it traverses a server link then - // source->nick becomes invalid as the object data moves in memory. - Srv->SendOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]); - Srv->ChangeUserNick(source,std::string(parameters[1])); + if (Srv->IsNick(std::string(parameters[1]))) + { + // FIX by brain: Cant use source->nick here because if it traverses a server link then + // source->nick becomes invalid as the object data moves in memory. + Srv->SendOpers(std::string(user->nick)+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]); + Srv->ChangeUserNick(source,std::string(parameters[1])); + } } } -} +}; class ModuleSanick : public Module { + cmd_sanick* mycommand; public: ModuleSanick(Server* Me) : Module::Module(Me) { Srv = Me; - Srv->AddCommand("SANICK",handle_sanick,'o',2,"m_sanick.so"); + mycommand = new cmd_sanick(); + Srv->AddCommand(mycommand); } virtual ~ModuleSanick() |