X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_stripcolor.cpp;h=592aeda906407076a3262949331bd789e847abbc;hb=c8602a49931e31593efefa45f141a06ce8e9a90f;hp=b7e26afd5bbf3d97119786062f5193cad7f2ec69;hpb=0d95204c9848a56b02a1aca717ddca7f5e60e5a6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index b7e26afd5..592aeda90 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -21,8 +21,6 @@ #include "inspircd.h" -/* $ModDesc: Provides channel +S mode (strip ansi color) */ - /** Handles channel mode +S */ class ChannelStripColor : public SimpleChannelModeHandler @@ -50,14 +48,6 @@ class ModuleStripColor : public Module { } - 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& tokens) CXX11_OVERRIDE { tokens["EXTBAN"].push_back('S'); @@ -72,7 +62,7 @@ class ModuleStripColor : public Module if (target_type == TYPE_USER) { User* t = (User*)dest; - active = t->IsModeSet('S'); + active = t->IsModeSet(usc); } else if (target_type == TYPE_CHANNEL) { @@ -82,7 +72,7 @@ class ModuleStripColor : public Module 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) @@ -93,6 +83,23 @@ class ModuleStripColor : public Module 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);