class ChannelStripColor : public SimpleChannelModeHandler
{
public:
- ChannelStripColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'S') { }
+ ChannelStripColor(Module* Creator) : SimpleChannelModeHandler(Creator, "stripcolor", 'S') { }
};
/** Handles user mode +S
class UserStripColor : public SimpleUserModeHandler
{
public:
- UserStripColor(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'S') { }
+ UserStripColor(Module* Creator) : SimpleUserModeHandler(Creator, "stripcolor", 'S') { }
};
UserStripColor usc;
public:
- ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me, this), usc(Me, this)
+ ModuleStripColor() : csc(this), usc(this)
{
if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc))
throw ModuleException("Could not add new modes!");
virtual ~ModuleStripColor()
{
- ServerInstance->Modes->DelMode(&usc);
- ServerInstance->Modes->DelMode(&csc);
}
virtual void On005Numeric(std::string &output)
}
}
- virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (!IS_LOCAL(user))
- return 0;
+ return MOD_RES_PASSTHRU;
bool active = false;
if (target_type == TYPE_USER)
else if (target_type == TYPE_CHANNEL)
{
Channel* t = (Channel*)dest;
+ ModResult res;
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,t,"stripcolor"));
- // check if we allow ops to bypass filtering, if we do, check if they're opped accordingly.
- // note: short circut logic here, don't wreck it. -- w00t
- if (CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetStatus(user) == STATUS_OP)
- {
- return 0;
- }
+ if (res == MOD_RES_ALLOW)
+ return MOD_RES_PASSTHRU;
- active = t->IsModeSet('S') || t->GetExtBanStatus(user, 'S') < 0;
+ active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet('S'));
}
if (active)
this->ReplaceLine(text);
}
- return 0;
+ return MOD_RES_PASSTHRU;
}
- virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+ virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
virtual Version GetVersion()
{
- return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+ return Version("Provides channel +S mode (strip ansi colour)", VF_COMMON | VF_VENDOR);
}
};