From 4a2b9ebcf38d6c0a2860b966421b3af125438488 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 25 May 2010 00:57:25 -0500 Subject: Renamed all of source files from .c to .cpp --- src/core/os_restart.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/core/os_restart.cpp (limited to 'src/core/os_restart.cpp') diff --git a/src/core/os_restart.cpp b/src/core/os_restart.cpp new file mode 100644 index 000000000..8904381f5 --- /dev/null +++ b/src/core/os_restart.cpp @@ -0,0 +1,64 @@ +/* OperServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandOSRestart : public Command +{ + public: + CommandOSRestart() : Command("RESTART", 0, 0, "operserv/restart") + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + quitmsg = new char[31 + u->nick.length()]; + if (!quitmsg) + quitmsg = "RESTART command received, but out of memory!"; + else + sprintf(const_cast(quitmsg), /* XXX */ "RESTART command received from %s", u->nick.c_str()); + + if (Config.GlobalOnCycle) + oper_global(NULL, "%s", Config.GlobalOnCycleMessage); + /* raise(SIGHUP); */ + do_restart_services(); + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(Config.s_OperServ, u, OPER_HELP_RESTART); + return true; + } +}; + +class OSRestart : public Module +{ + public: + OSRestart(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion(VERSION_STRING); + this->SetType(CORE); + this->AddCommand(OperServ, new CommandOSRestart()); + + ModuleManager::Attach(I_OnOperServHelp, this); + } + void OnOperServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RESTART); + } +}; + +MODULE_INIT(OSRestart) -- cgit From 6cd88494662c5c4af2da891926dcc82367596cb9 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 30 May 2010 17:21:44 -0400 Subject: Moved the *Serv help functions to Command, will come in use later with subcommands --- src/core/os_restart.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/core/os_restart.cpp') diff --git a/src/core/os_restart.cpp b/src/core/os_restart.cpp index 8904381f5..efb5bdada 100644 --- a/src/core/os_restart.cpp +++ b/src/core/os_restart.cpp @@ -41,6 +41,11 @@ class CommandOSRestart : public Command notice_help(Config.s_OperServ, u, OPER_HELP_RESTART); return true; } + + void OnServHelp(User *u) + { + notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RESTART); + } }; class OSRestart : public Module @@ -52,12 +57,6 @@ class OSRestart : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); this->AddCommand(OperServ, new CommandOSRestart()); - - ModuleManager::Attach(I_OnOperServHelp, this); - } - void OnOperServHelp(User *u) - { - notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RESTART); } }; -- cgit