1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 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 * ---------------------------------------------------
23 /* $ModDesc: Allows opers to set their idle time */
27 void handle_setidle(char **parameters, int pcnt, userrec *user)
29 if (atoi(parameters[0]) < 1)
31 WriteServ(user->fd,"948 %s :Invalid idle time.",user->nick);
34 user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
35 // minor tweak - we cant have signon time shorter than our idle time!
36 if (user->signon > user->idle_lastmsg)
37 user->signon = user->idle_lastmsg;
38 Srv->SendOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds");
39 WriteServ(user->fd,"944 %s :Idle time set.",user->nick);
43 class ModuleSetIdle : public Module
49 Srv->AddCommand("SETIDLE",handle_setidle,'o',1,"m_setidle.so");
52 virtual ~ModuleSetIdle()
58 virtual Version GetVersion()
60 return Version(1,0,0,1,VF_VENDOR);
65 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
67 class ModuleSetIdleFactory : public ModuleFactory
70 ModuleSetIdleFactory()
74 ~ModuleSetIdleFactory()
78 virtual Module * CreateModule()
80 return new ModuleSetIdle;
86 extern "C" void * init_module( void )
88 return new ModuleSetIdleFactory;