summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-11-15 18:26:44 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-11-15 18:26:44 +0000
commit8ab1381e8d277152d99a72f33f3d1c0564060fee (patch)
tree3dda11a9bb46c2f2142330c042ff43c4378ad33a /include
parentd3747f2943c403863bc31c8d3e9802ccc763f4d3 (diff)
Add ParamChannelModeHandler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12134 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/mode.h12
-rw-r--r--include/modes/cmode_l.h6
2 files changed, 13 insertions, 5 deletions
diff --git a/include/mode.h b/include/mode.h
index f1768f559..a633cebca 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -105,7 +105,7 @@ class CoreExport ModeHandler : public classbase
/**
* The mode letter you're implementing.
*/
- const char mode;
+ char mode;
/** Mode prefix, or 0
*/
@@ -325,6 +325,16 @@ class CoreExport SimpleChannelModeHandler : public ModeHandler
virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
};
+class CoreExport ParamChannelModeHandler : public ModeHandler
+{
+ public:
+ ParamChannelModeHandler(Module* Creator, const std::string& Name, char modeletter)
+ : ModeHandler(Creator, Name, modeletter, PARAM_SETONLY, MODETYPE_CHANNEL) {}
+ virtual ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
+ /** Validate the parameter - you may change the value to normalize it. Return true if it is valid. */
+ virtual bool ParamValidate(std::string& parameter);
+};
+
/**
* The ModeWatcher class can be used to alter the behaviour of a mode implemented
* by the core or by another module. To use ModeWatcher, derive a class from it,
diff --git a/include/modes/cmode_l.h b/include/modes/cmode_l.h
index dc93396d7..80e863057 100644
--- a/include/modes/cmode_l.h
+++ b/include/modes/cmode_l.h
@@ -13,14 +13,12 @@
#include "mode.h"
-class InspIRCd;
-
/** Channel mode +l
*/
-class ModeChannelLimit : public ModeHandler
+class ModeChannelLimit : public ParamChannelModeHandler
{
public:
ModeChannelLimit();
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
+ bool ParamValidate(std::string& parameter);
bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel* channel);
};