X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_helpop.cpp;h=ef9ae5e22e8e7d8ffcccaa8396f9c04bd6723e54;hb=7b6bd133ca4472f6cb8058d5e34e3c8b2af7e99a;hp=64bdc2400c6410a99d665c24d545c7b1de5f9cb6;hpb=b5bc73e31026ee2087f0ceb5c7d9f99bf3c288a6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 64bdc2400..ef9ae5e22 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -94,21 +94,22 @@ class CommandHelpop : public Command } }; -class ModuleHelpop : public Module +class ModuleHelpop : public Module, public Whois::EventListener { - std::string h_file; CommandHelpop cmd; Helpop ho; public: ModuleHelpop() - : cmd(this), ho(this) + : Whois::EventListener(this) + , cmd(this) + , ho(this) { } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - helpop_map.clear(); + HelpopMap help; ConfigTagList tags = ServerInstance->Config->ConfTags("helpop"); for(ConfigIter i = tags.first; i != tags.second; ++i) @@ -123,27 +124,28 @@ class ModuleHelpop : public Module throw ModuleException("m_helpop: The key 'index' is reserved for internal purposes. Please remove it."); } - helpop_map[key] = value; + help[key] = value; } - if (helpop_map.find("start") == helpop_map.end()) + if (help.find("start") == help.end()) { // error! throw ModuleException("m_helpop: Helpop file is missing important entry 'start'. Please check the example conf."); } - else if (helpop_map.find("nohelp") == helpop_map.end()) + else if (help.find("nohelp") == help.end()) { // error! throw ModuleException("m_helpop: Helpop file is missing important entry 'nohelp'. Please check the example conf."); } + helpop_map.swap(help); } - void OnWhois(User* src, User* dst) CXX11_OVERRIDE + void OnWhois(Whois::Context& whois) CXX11_OVERRIDE { - if (dst->IsModeSet(ho)) + if (whois.GetTarget()->IsModeSet(ho)) { - ServerInstance->SendWhoisLine(src, dst, 310, dst->nick+" :is available for help."); + whois.SendLine(310, ":is available for help."); } }