diff options
| author | 2024-03-08 20:50:45 +0000 | |
|---|---|---|
| committer | 2024-03-08 21:24:24 +0000 | |
| commit | eb052593789e12fc01b54abd9c4966029760eae0 (patch) | |
| tree | d8000c52d8aa0459abe475c3f842ed3b924468ee /src/modules/m_services.cpp | |
| parent | Don't send chat history to services servers. (diff) | |
Allow services to request seeing channel messages even if unguarded.
This allows services to enforce various channel-level restrictions
without a guard client in the channel.
Diffstat (limited to 'src/modules/m_services.cpp')
| -rw-r--r-- | src/modules/m_services.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 6c9330a7b..f5f031607 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -21,6 +21,7 @@ #include "listmode.h" #include "modules/account.h" #include "modules/ctctags.h" +#include "modules/server.h" #include "modules/stats.h" #include "timeutils.h" #include "xline.h" @@ -514,6 +515,7 @@ public: class ModuleServices final : public Module + , public ServerProtocol::RouteEventListener , public Stats::EventListener { private: @@ -523,6 +525,7 @@ private: ServiceTag servicetag; ServProtect servprotectmode; SVSHoldFactory svsholdfactory; + BoolExtItem auspexext; StringExtItem mlockext; BoolExtItem topiclockext; CommandSVSCMode svscmodecmd; @@ -575,12 +578,14 @@ private: public: ModuleServices() : Module(VF_COMMON | VF_VENDOR, "Provides support for integrating with a services server.") + , ServerProtocol::RouteEventListener(this) , Stats::EventListener(this) , accountapi(this) , registeredcmode(this) , registeredumode(this) , servicetag(this) , servprotectmode(this) + , auspexext(this, "auspex", ExtensionType::CHANNEL, true) , mlockext(this, "mlock", ExtensionType::CHANNEL, true) , topiclockext(this, "topiclock", ExtensionType::CHANNEL, true) , svscmodecmd(this) @@ -610,6 +615,15 @@ public: accountoverrideshold = tag->getBool("accountoverrideshold"); } + ModResult OnRouteMessage(const Channel* channel, const Server* server) override + { + if (!server->IsService() || !auspexext.Get(channel)) + return MOD_RES_PASSTHRU; + + // Allow services to see messages in this channel even if not guarded. + return MOD_RES_ALLOW; + } + ModResult OnKill(User* source, User* dest, const std::string& reason) override { if (!source) |
