]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_helpop.cpp
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / src / modules / m_helpop.cpp
index bbc7ae3acf7a7bfe416da2fcf58f0431ae372670..7bd49f84b276deda8ed9e992bb0738d230e05aca 100644 (file)
@@ -29,35 +29,13 @@ static std::map<irc::string, std::string> helpop_map;
 
 /** Handles user mode +h
  */
-class Helpop : public ModeHandler
+class Helpop : public SimpleUserModeHandler
 {
  public:
-       Helpop(Module* Creator) : ModeHandler(Creator, "helpop", 'h', PARAM_NONE, MODETYPE_USER)
+       Helpop(Module* Creator) : SimpleUserModeHandler(Creator, "helpop", 'h')
        {
                oper = true;
        }
-
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
-       {
-               if (adding)
-               {
-                       if (!dest->IsModeSet('h'))
-                       {
-                               dest->SetMode('h',true);
-                               return MODEACTION_ALLOW;
-                       }
-               }
-               else
-               {
-                       if (dest->IsModeSet('h'))
-                       {
-                               dest->SetMode('h',false);
-                               return MODEACTION_ALLOW;
-                       }
-               }
-
-               return MODEACTION_DENY;
-       }
 };
 
 /** Handles /HELPOP
@@ -120,7 +98,6 @@ class CommandHelpop : public Command
 
 class ModuleHelpop : public Module
 {
-       private:
                std::string  h_file;
                CommandHelpop cmd;
                Helpop ho;
@@ -137,7 +114,7 @@ class ModuleHelpop : public Module
                        ServerInstance->Modules->AddService(ho);
                        ServerInstance->Modules->AddService(cmd);
                        Implementation eventlist[] = { I_OnRehash, I_OnWhois };
-                       ServerInstance->Modules->Attach(eventlist, this, 2);
+                       ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
                }
 
                void ReadConfig()
@@ -182,7 +159,7 @@ class ModuleHelpop : public Module
                {
                        if (dst->IsModeSet('h'))
                        {
-                               ServerInstance->SendWhoisLine(src, dst, 310, std::string(src->nick)+" "+std::string(dst->nick)+" :is available for help.");
+                               ServerInstance->SendWhoisLine(src, dst, 310, src->nick+" "+dst->nick+" :is available for help.");
                        }
                }