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 * ---------------------------------------------------
22 #include "helperfuncs.h"
24 /* $ModDesc: Allows opers to set their idle time */
28 void handle_setidle(char **parameters, int pcnt, userrec *user)
30 if (atoi(parameters[0]) < 1)
32 WriteServ(user->fd,"948 %s :Invalid idle time.",user->nick);
35 user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
36 // minor tweak - we cant have signon time shorter than our idle time!
37 if (user->signon > user->idle_lastmsg)
38 user->signon = user->idle_lastmsg;
39 Srv->SendOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds");
40 WriteServ(user->fd,"944 %s :Idle time set.",user->nick);
44 class ModuleSetIdle : public Module
50 Srv->AddCommand("SETIDLE",handle_setidle,'o',1,"m_setidle.so");
53 virtual ~ModuleSetIdle()
59 virtual Version GetVersion()
61 return Version(1,0,0,1,VF_VENDOR);
66 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
68 class ModuleSetIdleFactory : public ModuleFactory
71 ModuleSetIdleFactory()
75 ~ModuleSetIdleFactory()
79 virtual Module * CreateModule()
81 return new ModuleSetIdle;
87 extern "C" void * init_module( void )
89 return new ModuleSetIdleFactory;