summaryrefslogtreecommitdiff
path: root/src/mode.cpp
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 /src/mode.cpp
parentd3747f2943c403863bc31c8d3e9802ccc763f4d3 (diff)
Add ParamChannelModeHandler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12134 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index fb154d5e2..e9635364e 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -176,6 +176,25 @@ ModeAction SimpleChannelModeHandler::OnModeChange(User* source, User* dest, Chan
return MODEACTION_DENY;
}
+ModeAction ParamChannelModeHandler::OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
+{
+ if (adding && !ParamValidate(parameter))
+ return MODEACTION_DENY;
+ std::string now = channel->GetModeParameter(this);
+ if (parameter == now)
+ return MODEACTION_DENY;
+ if (adding)
+ channel->SetModeParam(this, parameter);
+ else
+ channel->SetModeParam(this, "");
+ return MODEACTION_ALLOW;
+}
+
+bool ParamChannelModeHandler::ParamValidate(std::string& parameter)
+{
+ return true;
+}
+
ModeWatcher::ModeWatcher(Module* Creator, char modeletter, ModeType type)
: mode(modeletter), m_type(type), creator(Creator)
{