From 63f8e06d41b77bd8613d4279a93f7d623daa06e6 Mon Sep 17 00:00:00 2001 From: w00t Date: Fri, 6 Mar 2009 10:04:42 +0000 Subject: Convert helpop to use a ModeHandler base rather than a SimpleUserModeHandler, users should not be able to set +h. Fixes #750, reported by Taros. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11175 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_helpop.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/modules/m_helpop.cpp') diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 661860b0a..0cfca57d0 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -19,10 +19,32 @@ static std::map helpop_map; /** Handles user mode +h */ -class Helpop : public SimpleUserModeHandler +class Helpop : public ModeHandler { public: - Helpop(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'h') { } + Helpop(InspIRCd* Instance) : ModeHandler(Instance, 'h', 0, 0, false, MODETYPE_USER, true) { } + + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) + { + 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 -- cgit v1.2.3