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 * ---------------------------------------------------
24 #include "helperfuncs.h"
26 /* $ModDesc: Allows opers to set their idle time */
28 static Server *Srv = NULL;
30 class cmd_setidle : public command_t
33 cmd_setidle () : command_t("SETIDLE", 'o', 1)
35 this->source = "m_setidle.so";
38 void Handle (char **parameters, int pcnt, userrec *user)
40 if (atoi(parameters[0]) < 1)
42 WriteServ(user->fd,"948 %s :Invalid idle time.",user->nick);
45 user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
46 // minor tweak - we cant have signon time shorter than our idle time!
47 if (user->signon > user->idle_lastmsg)
48 user->signon = user->idle_lastmsg;
49 Srv->SendOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds");
50 WriteServ(user->fd,"944 %s :Idle time set.",user->nick);
55 class ModuleSetIdle : public Module
57 cmd_setidle* mycommand;
59 ModuleSetIdle(Server* Me)
63 mycommand = new cmd_setidle();
64 Srv->AddCommand(mycommand);
67 virtual ~ModuleSetIdle()
71 virtual Version GetVersion()
73 return Version(1,0,0,1,VF_VENDOR);
78 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
80 class ModuleSetIdleFactory : public ModuleFactory
83 ModuleSetIdleFactory()
87 ~ModuleSetIdleFactory()
91 virtual Module * CreateModule(Server* Me)
93 return new ModuleSetIdle(Me);
99 extern "C" void * init_module( void )
101 return new ModuleSetIdleFactory;