]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_helpop.cpp
Fix typo
[user/henk/code/inspircd.git] / src / modules / m_helpop.cpp
index f501676c3070a55dc2c70d17446dc06334bb0c95..f82004f162f09fb022e1dc62825ca6aab9aa9dbf 100644 (file)
@@ -55,17 +55,19 @@ class Helpop : public ModeHandler
 class cmd_helpop : public command_t
 {
  public:
-        cmd_helpop (InspIRCd* Instance) : command_t(Instance, "HELPOP", 0, 1)
-        {
-                this->source = "m_helpop.so";
-                syntax = "<any-text>";
-        }
+       cmd_helpop (InspIRCd* Instance) : command_t(Instance, "HELPOP", 0, 0)
+       {
+               this->source = "m_helpop.so";
+               syntax = "<any-text>";
+       }
 
        CmdResult Handle (const char** parameters, int pcnt, userrec *user)
-       {               
-               irc::string parameter = parameters[0];
+       {
+               irc::string parameter;
+               if (pcnt > 0)
+                       parameter = parameters[0];
 
-               if (parameter == "index")
+               if (pcnt == 0 || parameter == "index")
                {
                        /* iterate over all helpop items */
                        user->WriteServ("NOTICE %s :HELPOP topic index", user->nick);
@@ -118,7 +120,8 @@ class ModuleHelpop : public Module
                {
                        ReadConfig();
                        ho = new Helpop(ServerInstance);
-                       ServerInstance->AddMode(ho, 'h');
+                       if (!ServerInstance->AddMode(ho, 'h'))
+                               throw ModuleException("Could not add new modes!");
                        mycommand = new cmd_helpop(ServerInstance);
                        ServerInstance->AddCommand(mycommand);
                }
@@ -160,7 +163,7 @@ class ModuleHelpop : public Module
                        List[I_OnRehash] = List[I_OnWhois] = 1;
                }
 
-               virtual void OnRehash(const std::string &parameter)
+               virtual void OnRehash(userrec* user, const std::string &parameter)
                {
                        ReadConfig();
                }