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
This commit is contained in:
w00t 2009-03-06 10:04:42 +00:00
parent d17bf9f895
commit 63f8e06d41

View File

@ -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