diff options
| author | 2024-07-13 00:38:25 +0100 | |
|---|---|---|
| committer | 2024-07-13 00:38:25 +0100 | |
| commit | c3c97b917de8426cc0c0e9d87eda4efcfa88ef61 (patch) | |
| tree | 72dd6f05130450b7125c2114483ffd63fad3a3fa /src/modules | |
| parent | Fix an unescaped ampersand in the previous commit. (diff) | |
Allow using /ACCEPT to override more blocking modes.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_commonchans.cpp | 6 | ||||
| -rw-r--r-- | src/modules/m_noctcp.cpp | 12 | ||||
| -rw-r--r-- | src/modules/m_sslmodes.cpp | 5 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 94314b51d..33ed4bd99 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" +#include "modules/callerid.h" #include "modules/ctctags.h" #include "numerichelper.h" @@ -30,6 +31,7 @@ class ModuleCommonChans final , public CTCTags::EventListener { private: + CallerID::API calleridapi; SimpleUserMode mode; bool IsExempt(User* source, User* target) @@ -40,6 +42,9 @@ private: if (source->HasPrivPermission("users/ignore-commonchans") || source->server->IsService()) return true; // Source is an oper or a service. + if (calleridapi && calleridapi->IsOnAcceptList(source, target)) + return true; // Source is on the callerid accept list + return false; } @@ -60,6 +65,7 @@ public: ModuleCommonChans() : Module(VF_VENDOR, "Adds user mode c (deaf_commonchan) which requires users to have a common channel before they can privately message each other.") , CTCTags::EventListener(this) + , calleridapi(this) , mode(this, "deaf_commonchan", 'c') { } diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 7b3b92420..7bbb9feee 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -26,6 +26,7 @@ #include "inspircd.h" +#include "modules/callerid.h" #include "modules/exemption.h" #include "modules/extban.h" #include "numerichelper.h" @@ -34,6 +35,7 @@ class ModuleNoCTCP final : public Module { private: + CallerID::API calleridapi; CheckExemption::EventProvider exemptionprov; ExtBan::Acting extban; SimpleChannelMode nc; @@ -42,6 +44,7 @@ private: public: ModuleNoCTCP() : Module(VF_VENDOR, "Adds channel mode C (noctcp) which allows channels to block messages which contain CTCPs and user mode T (u_noctcp) which allows users to block private messages that contain CTCPs.") + , calleridapi(this) , exemptionprov(this) , extban(this, "noctcp", 'C') , nc(this, "noctcp", 'C') @@ -91,15 +94,18 @@ public: } case MessageTarget::TYPE_USER: { + auto* targetuser = target.Get<User>(); if (user->HasPrivPermission("users/ignore-noctcp")) return MOD_RES_PASSTHRU; - User* u = target.Get<User>(); - if (u->IsModeSet(ncu)) + if (calleridapi && calleridapi->IsOnAcceptList(user, targetuser)) + return MOD_RES_PASSTHRU; + + if (targetuser->IsModeSet(ncu)) { // Don't send an error message if we're blocking an automatic CTCP reply. if (details.type == MessageType::NOTICE) - user->WriteNumeric(Numerics::CannotSendTo(u, "CTCPs", &ncu)); + user->WriteNumeric(Numerics::CannotSendTo(targetuser, "CTCPs", &ncu)); return MOD_RES_DENY; } break; diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index e05c60d31..1304c296f 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -26,6 +26,7 @@ #include "inspircd.h" +#include "modules/callerid.h" #include "modules/ctctags.h" #include "modules/extban.h" #include "modules/ssl.h" @@ -165,6 +166,7 @@ class ModuleSSLModes final { private: UserCertificateAPI api; + CallerID::API calleridapi; SSLMode sslm; SSLModeUser sslquery; FingerprintExtBan extban; @@ -174,6 +176,7 @@ public: : Module(VF_VENDOR, "Adds channel mode z (sslonly) which prevents users who are not connecting using TLS from joining the channel and user mode z (sslqueries) to prevent messages from non-TLS users.") , CTCTags::EventListener(this) , api(this) + , calleridapi(this) , sslm(this, api) , sslquery(this, api) , extban(this, api) @@ -216,7 +219,7 @@ public: /* If the target is +z */ if (target->IsModeSet(sslquery)) { - if (!api || !api->IsSecure(user)) + if (!api || !api->IsSecure(user) || (calleridapi && !calleridapi->IsOnAcceptList(user, target))) { /* The sending user is not on an TLS connection */ user->WriteNumeric(Numerics::CannotSendTo(target, "messages", &sslquery)); |
