diff options
author | Adam <Adam@anope.org> | 2016-07-28 21:29:35 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-07-28 21:29:35 -0400 |
commit | 0e758a2ac23dc4a001e8e126cec14588da9a9769 (patch) | |
tree | 45df813323e023c5c89db7279426c4ad0943b4a9 /modules/help.cpp | |
parent | a3c8afae00c54d5b95c620248b51f90679d7d53f (diff) |
Allow serializable fields to use storage in the respective objects.
Split service management code nito a proper servicemanager. Make service
references managed instead of lazy lookup. Also made events and
serializable use service manager instead of their respective systems for
management
Diffstat (limited to 'modules/help.cpp')
-rw-r--r-- | modules/help.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/modules/help.cpp b/modules/help.cpp index debb25837..0e544dc1e 100644 --- a/modules/help.cpp +++ b/modules/help.cpp @@ -26,10 +26,8 @@ class CommandHelp : public Command return NULL; } - EventHandlers<Event::Help> &onhelp; - public: - CommandHelp(Module *creator, EventHandlers<Event::Help> &event) : Command(creator, "generic/help", 0), onhelp(event) + CommandHelp(Module *creator) : Command(creator, "generic/help", 0) { this->SetDesc(_("Displays this list and give information about commands")); this->AllowUnregistered(true); @@ -37,7 +35,7 @@ class CommandHelp : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - EventReturn MOD_RESULT = this->onhelp(&Event::Help::OnPreHelp, source, params); + EventReturn MOD_RESULT = EventManager::Get()->Dispatch(&Event::Help::OnPreHelp, source, params); if (MOD_RESULT == EVENT_STOP) return; @@ -70,7 +68,7 @@ class CommandHelp : public Command if (cmd != it->first && map.count(cmd)) continue; - ServiceReference<Command> c("Command", info.name); + ServiceReference<Command> c(info.name); if (!c) continue; @@ -133,7 +131,7 @@ class CommandHelp : public Command const CommandInfo &info = it->second; - ServiceReference<Command> c("Command", info.name); + ServiceReference<Command> c(info.name); if (!c) continue; @@ -176,19 +174,17 @@ class CommandHelp : public Command source.Reply(_("No help available for \002{0}\002."), params[0]); } - this->onhelp(&Event::Help::OnPostHelp, source, params); + EventManager::Get()->Dispatch(&Event::Help::OnPostHelp, source, params); } }; class Help : public Module { CommandHelp commandhelp; - EventHandlers<Event::Help> onhelp; public: Help(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) - , commandhelp(this, onhelp) - , onhelp(this) + , commandhelp(this) { } |