1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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 CommandSetidle : public Command
23 CommandSetidle (InspIRCd* Instance) : Command(Instance,"SETIDLE", "o", 1)
25 this->source = "m_setidle.so";
26 syntax = "<duration>";
27 TRANSLATE2(TR_TEXT, TR_END);
30 CmdResult Handle (const std::vector<std::string>& parameters, User *user)
32 time_t idle = ServerInstance->Duration(parameters[0]);
35 user->WriteNumeric(948, "%s :Invalid idle time.",user->nick.c_str());
38 user->idle_lastmsg = (ServerInstance->Time() - idle);
39 // minor tweak - we cant have signon time shorter than our idle time!
40 if (user->signon > user->idle_lastmsg)
41 user->signon = user->idle_lastmsg;
42 ServerInstance->SNO->WriteToSnoMask('a', std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
43 user->WriteNumeric(944, "%s :Idle time set.",user->nick.c_str());
50 class ModuleSetIdle : public Module
52 CommandSetidle* mycommand;
54 ModuleSetIdle(InspIRCd* Me)
58 mycommand = new CommandSetidle(ServerInstance);
59 ServerInstance->AddCommand(mycommand);
63 virtual ~ModuleSetIdle()
67 virtual Version GetVersion()
69 return Version("$Id$", VF_VENDOR, API_VERSION);
73 MODULE_INIT(ModuleSetIdle)