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 * ---------------------------------------------------
21 /* $ModDesc: Allows opers to set their idle time */
25 class cmd_setidle : public command_t
28 cmd_setidle (InspIRCd* Instance) : command_t(Instance,"SETIDLE", 'o', 1)
30 this->source = "m_setidle.so";
31 syntax = "<idle-seconds>";
34 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
36 if (atoi(parameters[0]) < 1)
38 user->WriteServ("948 %s :Invalid idle time.",user->nick);
41 user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
42 // minor tweak - we cant have signon time shorter than our idle time!
43 if (user->signon > user->idle_lastmsg)
44 user->signon = user->idle_lastmsg;
45 ServerInstance->WriteOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(atoi(parameters[0]))+" seconds");
46 user->WriteServ("944 %s :Idle time set.",user->nick);
53 class ModuleSetIdle : public Module
55 cmd_setidle* mycommand;
57 ModuleSetIdle(InspIRCd* Me)
61 mycommand = new cmd_setidle(ServerInstance);
62 ServerInstance->AddCommand(mycommand);
65 virtual ~ModuleSetIdle()
69 virtual Version GetVersion()
71 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
75 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
77 class ModuleSetIdleFactory : public ModuleFactory
80 ModuleSetIdleFactory()
84 ~ModuleSetIdleFactory()
88 virtual Module * CreateModule(InspIRCd* Me)
90 return new ModuleSetIdle(Me);
96 extern "C" void * init_module( void )
98 return new ModuleSetIdleFactory;