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 * ---------------------------------------------------
16 /* $ModDesc: Allows opers to set their idle time */
20 class cmd_setidle : public command_t
23 cmd_setidle (InspIRCd* Instance) : command_t(Instance,"SETIDLE", 'o', 1)
25 this->source = "m_setidle.so";
26 syntax = "<duration>";
29 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
31 time_t idle = ServerInstance->Duration(parameters[0]);
34 user->WriteServ("948 %s :Invalid idle time.",user->nick);
37 user->idle_lastmsg = (ServerInstance->Time() - idle);
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 ServerInstance->WriteOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
42 user->WriteServ("944 %s :Idle time set.",user->nick);
49 class ModuleSetIdle : public Module
51 cmd_setidle* mycommand;
53 ModuleSetIdle(InspIRCd* Me)
57 mycommand = new cmd_setidle(ServerInstance);
58 ServerInstance->AddCommand(mycommand);
61 virtual ~ModuleSetIdle()
65 virtual Version GetVersion()
67 return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
71 MODULE_INIT(ModuleSetIdle)