aboutsummaryrefslogtreecommitdiff
path: root/modules/botmode.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-05-11 15:55:06 +0100
committerGravatar Sadie Powell2026-05-11 16:02:45 +0100
commit9ffa06613bf56e14767bb3209f2b39dc5d28db56 (patch)
tree9a64261fb0e4cd6d96bc93d91019454226d6687f /modules/botmode.cpp
parentMerge branch 'insp4' into master. (diff)
parentAdd the bot extended ban. (diff)
Merge branch 'insp4' into master.
Diffstat (limited to 'modules/botmode.cpp')
-rw-r--r--modules/botmode.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/botmode.cpp b/modules/botmode.cpp
index f9d39e10d..95820db2e 100644
--- a/modules/botmode.cpp
+++ b/modules/botmode.cpp
@@ -23,10 +23,30 @@
#include "inspircd.h"
#include "modules/ctctags.h"
+#include "modules/extban.h"
#include "modules/isupport.h"
#include "modules/who.h"
#include "modules/whois.h"
+class BotExtBan final
+ : public ExtBan::MatchingBase
+{
+private:
+ SimpleUserMode& botmode;
+
+public:
+ BotExtBan(const WeakModulePtr& mod, SimpleUserMode& bm)
+ : ExtBan::MatchingBase(mod, "bot", 'B')
+ , botmode(bm)
+ {
+ }
+
+ bool IsMatch(ListModeBase* lm, User* user, Channel* channel, const std::string& text, const ExtBan::MatchConfig& config) override
+ {
+ return user->IsModeSet(botmode) && config.next_match(lm, user, channel, text, config);
+ }
+};
+
class BotTag final
: public CTCTags::TagProvider
{
@@ -56,6 +76,7 @@ class ModuleBotMode final
{
private:
SimpleUserMode bm;
+ BotExtBan extban;
BotTag tag;
bool forcenotice;
@@ -66,6 +87,7 @@ public:
, Who::EventListener(weak_from_this())
, Whois::EventListener(weak_from_this())
, bm(weak_from_this(), "bot", 'B')
+ , extban(weak_from_this(), bm)
, tag(weak_from_this(), bm)
{
}