]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_helpop.cpp
m_spanningtree Remove SpanningTreeUtilities* fields and parameters
[user/henk/code/inspircd.git] / src / modules / m_helpop.cpp
index bbc7ae3acf7a7bfe416da2fcf58f0431ae372670..7d7e9663ae6734c434dbc961d3da35e21399efe2 100644 (file)
  */
 
 
-/* $ModDesc: Provides the /HELPOP command for useful information */
-
 #include "inspircd.h"
 
 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 +96,6 @@ class CommandHelpop : public Command
 
 class ModuleHelpop : public Module
 {
-       private:
                std::string  h_file;
                CommandHelpop cmd;
                Helpop ho;
@@ -131,13 +106,11 @@ class ModuleHelpop : public Module
                {
                }
 
-               void init()
+               void init() CXX11_OVERRIDE
                {
                        ReadConfig();
                        ServerInstance->Modules->AddService(ho);
                        ServerInstance->Modules->AddService(cmd);
-                       Implementation eventlist[] = { I_OnRehash, I_OnWhois };
-                       ServerInstance->Modules->Attach(eventlist, this, 2);
                }
 
                void ReadConfig()
@@ -173,20 +146,20 @@ class ModuleHelpop : public Module
 
                }
 
-               void OnRehash(User* user)
+               void OnRehash(User* user) CXX11_OVERRIDE
                {
                        ReadConfig();
                }
 
-               void OnWhois(User* src, User* dst)
+               void OnWhois(User* src, User* dst) CXX11_OVERRIDE
                {
-                       if (dst->IsModeSet('h'))
+                       if (dst->IsModeSet(ho))
                        {
-                               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.");
                        }
                }
 
-               Version GetVersion()
+               Version GetVersion() CXX11_OVERRIDE
                {
                        return Version("Provides the /HELPOP command for useful information", VF_VENDOR);
                }