diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-16 18:33:06 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-16 18:33:06 +0000 |
commit | 2e2d1fae4844088f7e0b9a71116e0eb3e149e4cc (patch) | |
tree | 544f6f31ec2c6f7714ebc4614a5623f6e6ec8a69 /src/modules/m_setidle.cpp | |
parent | ab9d8fd1af3ebf028506ec543f74fd13471742dd (diff) |
Moved to new command system
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2536 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_setidle.cpp')
-rw-r--r-- | src/modules/m_setidle.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 3ec1719da..ffa84d479 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -26,31 +26,42 @@ using namespace std; /* $ModDesc: Allows opers to set their idle time */ Server *Srv = NULL; - -void handle_setidle(char **parameters, int pcnt, userrec *user) + +class cmd_setidle : public command_t { - if (atoi(parameters[0]) < 1) + public: + cmd_setidle () : command_t("SETIDLE", 'o', 1) { - WriteServ(user->fd,"948 %s :Invalid idle time.",user->nick); - return; + this->source = "m_setidle.so"; } - user->idle_lastmsg = time(NULL) - atoi(parameters[0]); - // minor tweak - we cant have signon time shorter than our idle time! - if (user->signon > user->idle_lastmsg) - user->signon = user->idle_lastmsg; - Srv->SendOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds"); - WriteServ(user->fd,"944 %s :Idle time set.",user->nick); -} + + void Handle (char **parameters, int pcnt, userrec *user) + { + if (atoi(parameters[0]) < 1) + { + WriteServ(user->fd,"948 %s :Invalid idle time.",user->nick); + return; + } + user->idle_lastmsg = time(NULL) - atoi(parameters[0]); + // minor tweak - we cant have signon time shorter than our idle time! + if (user->signon > user->idle_lastmsg) + user->signon = user->idle_lastmsg; + Srv->SendOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds"); + WriteServ(user->fd,"944 %s :Idle time set.",user->nick); + } +}; class ModuleSetIdle : public Module { + cmd_setidle* mycommand; public: ModuleSetIdle(Server* Me) : Module::Module(Me) { Srv = Me; - Srv->AddCommand("SETIDLE",handle_setidle,'o',1,"m_setidle.so"); + mycommand = new cmd_setidle(); + Srv->AddCommand(mycommand); } virtual ~ModuleSetIdle() |