summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mode.h16
-rw-r--r--src/modules/m_helpop.cpp20
-rw-r--r--src/modules/m_operchans.cpp14
3 files changed, 20 insertions, 30 deletions
diff --git a/include/mode.h b/include/mode.h
index 7dc7feaec..7ef4548af 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -451,8 +451,12 @@ class CoreExport PrefixMode : public ModeHandler
class CoreExport SimpleUserModeHandler : public ModeHandler
{
public:
- SimpleUserModeHandler(Module* Creator, const std::string& Name, char modeletter)
- : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_USER) {}
+ SimpleUserModeHandler(Module* Creator, const std::string& Name, char modeletter, bool operonly = false)
+ : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_USER)
+ {
+ oper = operonly;
+ }
+
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
};
@@ -464,8 +468,12 @@ class CoreExport SimpleUserModeHandler : public ModeHandler
class CoreExport SimpleChannelModeHandler : public ModeHandler
{
public:
- SimpleChannelModeHandler(Module* Creator, const std::string& Name, char modeletter)
- : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_CHANNEL) {}
+ SimpleChannelModeHandler(Module* Creator, const std::string& Name, char modeletter, bool operonly = false)
+ : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_CHANNEL)
+ {
+ oper = operonly;
+ }
+
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE;
};
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 5aa719c2f..d957fb786 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -39,17 +39,6 @@ enum
typedef std::map<std::string, std::string, irc::insensitive_swo> HelpopMap;
static HelpopMap helpop_map;
-/** Handles user mode +h
- */
-class Helpop : public SimpleUserModeHandler
-{
- public:
- Helpop(Module* Creator) : SimpleUserModeHandler(Creator, "helpop", 'h')
- {
- oper = true;
- }
-};
-
/** Handles /HELPOP
*/
class CommandHelpop : public Command
@@ -107,16 +96,19 @@ class CommandHelpop : public Command
}
};
-class ModuleHelpop : public Module, public Whois::EventListener
+class ModuleHelpop
+ : public Module
+ , public Whois::EventListener
{
+ private:
CommandHelpop cmd;
- Helpop ho;
+ SimpleUserModeHandler ho;
public:
ModuleHelpop()
: Whois::EventListener(this)
, cmd(this)
- , ho(this)
+ , ho(this, "helpop", 'h', true)
{
}
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 8f6003923..6863fc244 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -28,26 +28,16 @@ enum
ERR_CANTJOINOPERSONLY = 520
};
-class OperChans : public SimpleChannelModeHandler
-{
- public:
- /* This is an oper-only mode */
- OperChans(Module* Creator) : SimpleChannelModeHandler(Creator, "operonly", 'O')
- {
- oper = true;
- }
-};
-
class ModuleOperChans : public Module
{
private:
- OperChans oc;
+ SimpleChannelModeHandler oc;
std::string space;
std::string underscore;
public:
ModuleOperChans()
- : oc(this)
+ : oc(this, "operonly", 'O', true)
, space(" ")
, underscore("_")
{