aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-07-06 21:19:20 +0100
committerGravatar Sadie Powell2023-07-06 21:19:20 +0100
commite6d5dfe0a07e777fc7826e18fac11632eb24f63f (patch)
tree199a3d34708bd867c3f7ad4a6765ef9cae212961 /src
parentRemove an unnecessary check from core_user. (diff)
Respect notifyuser in the muteban part handler.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_muteban.cpp24
1 files changed, 20 insertions, 4 deletions
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();
}
};