1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 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(Module* Creator) : Command(Creator,"SETIDLE", 1)
25 flags_needed = 'o'; syntax = "<duration>";
26 TRANSLATE2(TR_TEXT, TR_END);
29 CmdResult Handle (const std::vector<std::string>& parameters, User *user)
31 time_t idle = ServerInstance->Duration(parameters[0]);
34 user->WriteNumeric(948, "%s :Invalid idle time.",user->nick.c_str());
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->SNO->WriteToSnoMask('a', std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
42 user->WriteNumeric(944, "%s :Idle time set.",user->nick.c_str());
49 class ModuleSetIdle : public Module
56 ServerInstance->AddCommand(&cmd);
59 virtual ~ModuleSetIdle()
63 virtual Version GetVersion()
65 return Version("Allows opers to set their idle time", VF_VENDOR);
69 MODULE_INIT(ModuleSetIdle)