From 8ab1381e8d277152d99a72f33f3d1c0564060fee Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 15 Nov 2009 18:26:44 +0000 Subject: Add ParamChannelModeHandler git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12134 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mode.cpp') 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 ¶meter, 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) { -- cgit v1.2.3