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_samode.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_samode.cpp')
-rw-r--r-- | src/modules/m_samode.cpp | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index e60f8bf03..fe699eb9a 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -38,34 +38,44 @@ using namespace std; Server *Srv; - -void handle_samode(char **parameters, int pcnt, userrec *user) +class cmd_samode : public command_t { - /* - * Handles an SAMODE request. Notifies all +s users. - */ - int n=0; - std::string result; - Srv->Log(DEBUG,"SAMODE: Being handled"); - Srv->SendMode(parameters,pcnt,user); - Srv->Log(DEBUG,"SAMODE: Modechange handled"); - result = std::string(user->nick) + std::string(" used SAMODE "); - while (n<pcnt) + public: + cmd_samode () : command_t("SAMODE", 'o', 2) { - result=result + std::string(" ") + std::string(parameters[n]); - n++; + this->source = "m_samode.so"; } - Srv->SendOpers(result); -} + + void Handle (char **parameters, int pcnt, userrec *user) + { + /* + * Handles an SAMODE request. Notifies all +s users. + */ + int n=0; + std::string result; + Srv->Log(DEBUG,"SAMODE: Being handled"); + Srv->SendMode(parameters,pcnt,user); + Srv->Log(DEBUG,"SAMODE: Modechange handled"); + result = std::string(user->nick) + std::string(" used SAMODE "); + while (n<pcnt) + { + result=result + std::string(" ") + std::string(parameters[n]); + n++; + } + Srv->SendOpers(result); + } +}; class ModuleSaMode : public Module { + cmd_samode* mycommand; public: ModuleSaMode(Server* Me) : Module::Module(Me) { Srv = Me; - Srv->AddCommand("SAMODE",handle_samode,'o',2,"m_samode.so"); + mycommand = new cmd_samode(); + Srv->AddCommand(mycommand); } virtual ~ModuleSaMode() |