+ void OnUserPart(Membership* memb, std::string& partmessage, CUList& except_list) CXX11_OVERRIDE
+ {
+ if (!memb)
+ return;
+
+ User* user = memb->user;
+ Channel* chan = memb->chan;
+ ChanFilter::ListItem* match = Match(user, chan, partmessage);
+ if (!match)
+ return;
+
+ // Match() checks the user is local, we can assume from here
+ LocalUser* luser = IS_LOCAL(user);
+
+ std::string oldreason(partmessage);
+ partmessage = "Reason filtered";
+ if (!notifyuser)
+ {
+ // Send fake part
+ ClientProtocol::Messages::Part partmsg(memb, oldreason);
+ ClientProtocol::Event ev(ServerInstance->GetRFCEvents().part, partmsg);
+ luser->Send(ev);
+
+ // Don't send the user the changed message
+ except_list.insert(user);
+ return;
+ }
+
+ if (hidemask)
+ user->WriteNumeric(Numerics::CannotSendTo(chan, "Your part message contained a banned phrase and was blocked."));
+ else
+ user->WriteNumeric(Numerics::CannotSendTo(chan, InspIRCd::Format("Your part message contained a banned phrase (%s) and was blocked.",
+ match->mask.c_str())));
+ }
+