#include "inspircd.h"
-/* $ModDesc: Provides channel +S mode (strip ansi color) */
-
/** Handles channel mode +S
*/
class ChannelStripColor : public SimpleChannelModeHandler
{
}
- void init() CXX11_OVERRIDE
- {
- ServerInstance->Modules->AddService(usc);
- ServerInstance->Modules->AddService(csc);
- Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric };
- ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
- }
-
void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
{
tokens["EXTBAN"].push_back('S');
if (target_type == TYPE_USER)
{
User* t = (User*)dest;
- active = t->IsModeSet('S');
+ active = t->IsModeSet(usc);
}
else if (target_type == TYPE_CHANNEL)
{
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
- active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet('S'));
+ active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet(csc));
}
if (active)
return MOD_RES_PASSTHRU;
}
+ void OnUserPart(Membership* memb, std::string& partmessage, CUList& except_list) CXX11_OVERRIDE
+ {
+ User* user = memb->user;
+ Channel* channel = memb->chan;
+
+ if (!IS_LOCAL(user))
+ return;
+
+ bool active = channel->GetExtBanStatus(user, 'S').check(!user->IsModeSet(csc))
+ && ServerInstance->OnCheckExemption(user, channel, "stripcolor") != MOD_RES_ALLOW;
+
+ if (active)
+ {
+ InspIRCd::StripColor(partmessage);
+ }
+ }
+
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides channel +S mode (strip ansi color)", VF_VENDOR);