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 * ---------------------------------------------------
27 /* $ModDesc: Allows opers to set their idle time */
31 class cmd_setidle : public command_t
34 cmd_setidle (InspIRCd* Instance) : command_t(Instance,"SETIDLE", 'o', 1)
36 this->source = "m_setidle.so";
37 syntax = "<idle-seconds>";
40 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
42 if (atoi(parameters[0]) < 1)
44 user->WriteServ("948 %s :Invalid idle time.",user->nick);
47 user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
48 // minor tweak - we cant have signon time shorter than our idle time!
49 if (user->signon > user->idle_lastmsg)
50 user->signon = user->idle_lastmsg;
51 ServerInstance->WriteOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(atoi(parameters[0]))+" seconds");
52 user->WriteServ("944 %s :Idle time set.",user->nick);
59 class ModuleSetIdle : public Module
61 cmd_setidle* mycommand;
63 ModuleSetIdle(InspIRCd* Me)
67 mycommand = new cmd_setidle(ServerInstance);
68 ServerInstance->AddCommand(mycommand);
71 virtual ~ModuleSetIdle()
75 virtual Version GetVersion()
77 return Version(1,0,0,1,VF_VENDOR);
82 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
84 class ModuleSetIdleFactory : public ModuleFactory
87 ModuleSetIdleFactory()
91 ~ModuleSetIdleFactory()
95 virtual Module * CreateModule(InspIRCd* Me)
97 return new ModuleSetIdle(Me);
103 extern "C" void * init_module( void )
105 return new ModuleSetIdleFactory;