X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_setidle.cpp;h=8bca7000bb4cb0389b8e3e7cebf236785cafbaea;hb=4047a143fc1d16350db70c94b9ea77d79de05714;hp=7423e2672ea95139f1c7eaa524856a0dc255bbf0;hpb=66b90807bb94d88c8a34ec8a1fd7c1558941c47a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 7423e2672..8bca7000b 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -21,7 +21,12 @@ #include "inspircd.h" -/* $ModDesc: Allows opers to set their idle time */ +enum +{ + // InspIRCd-specific. + ERR_INVALIDIDLETIME = 948, + RPL_IDLETIMESET = 944 +}; /** Handle /SETIDLE */ @@ -31,15 +36,14 @@ class CommandSetidle : public SplitCommand CommandSetidle(Module* Creator) : SplitCommand(Creator,"SETIDLE", 1) { flags_needed = 'o'; syntax = ""; - TRANSLATE2(TR_TEXT, TR_END); } - CmdResult HandleLocal(const std::vector& parameters, LocalUser* user) + CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE { - time_t idle = ServerInstance->Duration(parameters[0]); - if (idle < 1) + unsigned long idle; + if (!InspIRCd::Duration(parameters[0], idle)) { - user->WriteNumeric(948, "%s :Invalid idle time.",user->nick.c_str()); + user->WriteNumeric(ERR_INVALIDIDLETIME, "Invalid idle time."); return CMD_FAILURE; } user->idle_lastmsg = (ServerInstance->Time() - idle); @@ -47,7 +51,7 @@ class CommandSetidle : public SplitCommand if (user->signon > user->idle_lastmsg) user->signon = user->idle_lastmsg; ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds"); - user->WriteNumeric(944, "%s :Idle time set.",user->nick.c_str()); + user->WriteNumeric(RPL_IDLETIMESET, "Idle time set."); return CMD_SUCCESS; } @@ -63,16 +67,7 @@ class ModuleSetIdle : public Module { } - void init() - { - ServerInstance->Modules->AddService(cmd); - } - - virtual ~ModuleSetIdle() - { - } - - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Allows opers to set their idle time", VF_VENDOR); }