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