From e6d5dfe0a07e777fc7826e18fac11632eb24f63f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 6 Jul 2023 21:19:20 +0100 Subject: Respect notifyuser in the muteban part handler. --- src/modules/m_muteban.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index cb958f3cb..96e7beba7 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" +#include "clientprotocolevent.h" #include "modules/ctctags.h" #include "modules/extban.h" #include "numerichelper.h" @@ -79,13 +80,28 @@ public: return HandleMessage(user, target, details.echo_original); } - void OnUserPart(Membership* memb, std::string& partmessage, CUList& excepts) override + void OnUserPart(Membership* memb, std::string& partmessage, CUList& except_list) override { - if (!IS_LOCAL(memb->user)) + LocalUser* luser = IS_LOCAL(memb->user); + if (!luser) return; - if (extban.GetStatus(memb->user, memb->chan) == MOD_RES_DENY) - partmessage.clear(); + if (extban.GetStatus(memb->user, memb->chan) != MOD_RES_DENY) + return; + + if (!notifyuser) + { + // Send fake part + const std::string oldreason = partmessage; + 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(luser); + return; + } + partmessage.clear(); } }; -- cgit v1.3.1-10-gc9f91