summaryrefslogtreecommitdiff
path: root/modules/operserv/reload.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-12-14 16:52:24 -0500
committerAdam <Adam@anope.org>2015-12-14 16:52:24 -0500
commit6302f980fe6dad83aab7d2dc1046dadea5ffd939 (patch)
tree4c27d33f55fc32ce34827977932dac4b3e5ceedd /modules/operserv/reload.cpp
parent64dac60071fab652745a6e7a06cf6b7bdbbd3625 (diff)
New source tree structure for modules. From commands/cs_access => chanserv/access etc.
Diffstat (limited to 'modules/operserv/reload.cpp')
-rw-r--r--modules/operserv/reload.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/operserv/reload.cpp b/modules/operserv/reload.cpp
new file mode 100644
index 000000000..217194e18
--- /dev/null
+++ b/modules/operserv/reload.cpp
@@ -0,0 +1,62 @@
+/* OperServ core functions
+ *
+ * (C) 2003-2014 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 CommandOSReload : public Command
+{
+ public:
+ CommandOSReload(Module *creator) : Command(creator, "operserv/reload", 0, 0)
+ {
+ this->SetDesc(_("Reload services' configuration file"));
+ }
+
+ void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
+ {
+ try
+ {
+ Log(LOG_ADMIN, source, this);
+
+ Configuration::Conf *new_config = new Configuration::Conf();
+ Configuration::Conf *old = Config;
+ Config = new_config;
+ Config->Post(old);
+ delete old;
+
+ source.Reply(_("Services' configuration has been reloaded."));
+ }
+ catch (const ConfigException &ex)
+ {
+ Log(this->owner) << "Error reloading configuration file: " << ex.GetReason();
+ source.Reply(_("Error reloading configuration file: {0}"), ex.GetReason());
+ }
+ }
+
+ bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
+ {
+ source.Reply(_("Causes Services to reload the configuration file."));
+ return true;
+ }
+};
+
+class OSReload : public Module
+{
+ CommandOSReload commandosreload;
+
+ public:
+ OSReload(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
+ , commandosreload(this)
+ {
+
+ }
+};
+
+MODULE_INIT(OSReload)