1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
19 /* $ModDesc: Allows opers to set their idle time */
23 class cmd_setidle : public command_t
26 cmd_setidle (InspIRCd* Instance) : command_t(Instance,"SETIDLE", 'o', 1)
28 this->source = "m_setidle.so";
29 syntax = "<idle-seconds>";
32 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
34 if (atoi(parameters[0]) < 1)
36 user->WriteServ("948 %s :Invalid idle time.",user->nick);
39 user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
40 // minor tweak - we cant have signon time shorter than our idle time!
41 if (user->signon > user->idle_lastmsg)
42 user->signon = user->idle_lastmsg;
43 ServerInstance->WriteOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(atoi(parameters[0]))+" seconds");
44 user->WriteServ("944 %s :Idle time set.",user->nick);
51 class ModuleSetIdle : public Module
53 cmd_setidle* mycommand;
55 ModuleSetIdle(InspIRCd* Me)
59 mycommand = new cmd_setidle(ServerInstance);
60 ServerInstance->AddCommand(mycommand);
63 virtual ~ModuleSetIdle()
67 virtual Version GetVersion()
69 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
73 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
75 class ModuleSetIdleFactory : public ModuleFactory
78 ModuleSetIdleFactory()
82 ~ModuleSetIdleFactory()
86 virtual Module * CreateModule(InspIRCd* Me)
88 return new ModuleSetIdle(Me);
94 extern "C" DllExport void * init_module( void )
96 return new ModuleSetIdleFactory;