]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_helpop.cpp
m_cap Convert capability names in CAP REQ to lowercase before processing them
[user/henk/code/inspircd.git] / src / modules / m_helpop.cpp
index ba0bc62fb73ce2e64d802c355e49c3bd67b5d49c..d07898c90801c0a199c9e6bfd24f8d9ebe0ee8a9 100644 (file)
@@ -21,8 +21,6 @@
  */
 
 
-/* $ModDesc: Provides the /HELPOP command for useful information */
-
 #include "inspircd.h"
 
 static std::map<irc::string, std::string> helpop_map;
@@ -57,17 +55,15 @@ class CommandHelpop : public Command
                if (parameter == "index")
                {
                        /* iterate over all helpop items */
-                       user->WriteServ("290 %s :HELPOP topic index", user->nick.c_str());
+                       user->WriteNumeric(290, ":HELPOP topic index");
                        for (std::map<irc::string, std::string>::iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++)
-                       {
-                               user->WriteServ("292 %s :  %s", user->nick.c_str(), iter->first.c_str());
-                       }
-                       user->WriteServ("292 %s :*** End of HELPOP topic index", user->nick.c_str());
+                               user->WriteNumeric(292, ":  %s", iter->first.c_str());
+                       user->WriteNumeric(292, ":*** End of HELPOP topic index");
                }
                else
                {
-                       user->WriteServ("290 %s :*** HELPOP for %s", user->nick.c_str(), parameter.c_str());
-                       user->WriteServ("292 %s : -", user->nick.c_str());
+                       user->WriteNumeric(290, ":*** HELPOP for %s", parameter.c_str());
+                       user->WriteNumeric(292, ": -");
 
                        std::map<irc::string, std::string>::iterator iter = helpop_map.find(parameter);
 
@@ -84,13 +80,13 @@ class CommandHelpop : public Command
                        {
                                // Writing a blank line will not work with some clients
                                if (token.empty())
-                                       user->WriteServ("292 %s : ", user->nick.c_str());
+                                       user->WriteNumeric(292, ": ");
                                else
-                                       user->WriteServ("292 %s :%s", user->nick.c_str(), token.c_str());
+                                       user->WriteNumeric(292, ":%s", token.c_str());
                        }
 
-                       user->WriteServ("292 %s : -", user->nick.c_str());
-                       user->WriteServ("292 %s :*** End of HELPOP", user->nick.c_str());
+                       user->WriteNumeric(292, ": -");
+                       user->WriteNumeric(292, ":*** End of HELPOP");
                }
                return CMD_SUCCESS;
        }
@@ -108,16 +104,7 @@ class ModuleHelpop : public Module
                {
                }
 
-               void init() CXX11_OVERRIDE
-               {
-                       ReadConfig();
-                       ServerInstance->Modules->AddService(ho);
-                       ServerInstance->Modules->AddService(cmd);
-                       Implementation eventlist[] = { I_OnRehash, I_OnWhois };
-                       ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
-               }
-
-               void ReadConfig()
+               void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
                {
                        helpop_map.clear();
 
@@ -150,16 +137,11 @@ class ModuleHelpop : public Module
 
                }
 
-               void OnRehash(User* user) CXX11_OVERRIDE
-               {
-                       ReadConfig();
-               }
-
                void OnWhois(User* src, User* dst) CXX11_OVERRIDE
                {
                        if (dst->IsModeSet(ho))
                        {
-                               ServerInstance->SendWhoisLine(src, dst, 310, src->nick+" "+dst->nick+" :is available for help.");
+                               ServerInstance->SendWhoisLine(src, dst, 310, dst->nick+" :is available for help.");
                        }
                }