2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
5 * Copyright (C) 2013, 2017-2018, 2020 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2012-2013 Attila Molnar <attilamolnar@hush.com>
7 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
8 * Copyright (C) 2010 Craig Edwards <brain@inspircd.org>
9 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
10 * Copyright (C) 2009 Robin Burchell <robin+git@viroteck.net>
11 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
12 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
14 * This file is part of InspIRCd. InspIRCd is free software: you can
15 * redistribute it and/or modify it under the terms of the GNU General Public
16 * License as published by the Free Software Foundation, version 2.
18 * This program is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 ERR_INVALIDIDLETIME = 948,
39 class CommandSetidle : public SplitCommand
42 CommandSetidle(Module* Creator) : SplitCommand(Creator,"SETIDLE", 1)
45 syntax = "<duration>";
48 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE
51 if (!InspIRCd::Duration(parameters[0], idle))
53 user->WriteNumeric(ERR_INVALIDIDLETIME, "Invalid idle time.");
56 user->idle_lastmsg = (ServerInstance->Time() - idle);
57 // minor tweak - we cant have signon time shorter than our idle time!
58 if (user->signon > user->idle_lastmsg)
59 user->signon = user->idle_lastmsg;
60 ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
61 user->WriteNumeric(RPL_IDLETIMESET, "Idle time set.");
68 class ModuleSetIdle : public Module
77 Version GetVersion() CXX11_OVERRIDE
79 return Version("Adds the /SETIDLE command which allows server operators to change their idle time.", VF_VENDOR);
83 MODULE_INIT(ModuleSetIdle)