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 = "<duration>";
32 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
34 time_t idle = ServerInstance->Duration(parameters[0]);
37 user->WriteServ("948 %s :Invalid idle time.",user->nick);
40 user->idle_lastmsg = (ServerInstance->Time() - idle);
41 // minor tweak - we cant have signon time shorter than our idle time!
42 if (user->signon > user->idle_lastmsg)
43 user->signon = user->idle_lastmsg;
44 ServerInstance->WriteOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
45 user->WriteServ("944 %s :Idle time set.",user->nick);
52 class ModuleSetIdle : public Module
54 cmd_setidle* mycommand;
56 ModuleSetIdle(InspIRCd* Me)
60 mycommand = new cmd_setidle(ServerInstance);
61 ServerInstance->AddCommand(mycommand);
64 virtual ~ModuleSetIdle()
68 virtual Version GetVersion()
70 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
74 MODULE_INIT(ModuleSetIdle)