/** Handles user mode +H
*/
-class HideOper : public ModeHandler
+class HideOper : public SimpleUserModeHandler
{
public:
- HideOper(Module* Creator) : ModeHandler(Creator, "hideoper", 'H', PARAM_NONE, MODETYPE_USER)
+ HideOper(Module* Creator) : SimpleUserModeHandler(Creator, "hideoper", 'H')
{
oper = true;
}
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
- {
- 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;
- }
};
class ModuleHideOper : public Module
ModuleHideOper()
: hm(this)
{
- if (!ServerInstance->Modes->AddMode(&hm))
- throw ModuleException("Could not add new modes!");
+ }
+
+ void init()
+ {
+ ServerInstance->Modules->AddService(hm);
Implementation eventlist[] = { I_OnWhoisLine, I_OnSendWhoLine };
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}