]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_helpop.cpp
Merge pull request #1139 from johanna-a/master
[user/henk/code/inspircd.git] / src / modules / m_helpop.cpp
index 64bdc2400c6410a99d665c24d545c7b1de5f9cb6..ef9ae5e22e8e7d8ffcccaa8396f9c04bd6723e54 100644 (file)
@@ -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.");
                        }
                }