summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-06 10:04:42 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-06 10:04:42 +0000
commit63f8e06d41b77bd8613d4279a93f7d623daa06e6 (patch)
treeaebea7852fccbb9dce5b0bda3b277cfee1ad7077
parentd17bf9f895b8d90ef5b9402d08cbd3815d181ed6 (diff)
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
-rw-r--r--src/modules/m_helpop.cpp26
1 files changed, 24 insertions, 2 deletions
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<irc::string, std::string> 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 &parameter, 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