diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_callerid.cpp | 20 | ||||
-rw-r--r-- | src/modules/m_delaymsg.cpp | 25 | ||||
-rw-r--r-- | src/modules/m_messageflood.cpp | 22 | ||||
-rw-r--r-- | src/modules/m_muteban.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_restrictmsg.cpp | 25 | ||||
-rw-r--r-- | src/modules/m_services_account.cpp | 19 | ||||
-rw-r--r-- | src/modules/m_sslmodes.cpp | 20 |
7 files changed, 134 insertions, 21 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index edf9d6c8e..f2cf112bf 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "modules/callerid.h" +#include "modules/ctctags.h" enum { @@ -345,7 +346,9 @@ class CallerIDAPIImpl : public CallerID::APIBase }; -class ModuleCallerID : public Module +class ModuleCallerID + : public Module + , public CTCTags::EventListener { CommandAccept cmd; CallerIDAPIImpl api; @@ -380,7 +383,8 @@ class ModuleCallerID : public Module public: ModuleCallerID() - : cmd(this) + : CTCTags::EventListener(this) + , cmd(this) , api(this, cmd.extInfo) , myumode(this, "callerid", 'g') { @@ -397,7 +401,7 @@ public: tokens["CALLERID"] = ConvToStr(myumode.GetModeChar()); } - ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + ModResult HandleMessage(User* user, const MessageTarget& target) { if (!IS_LOCAL(user) || target.type != MessageTarget::TYPE_USER) return MOD_RES_PASSTHRU; @@ -427,6 +431,16 @@ public: return MOD_RES_PASSTHRU; } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + void OnUserPostNick(User* user, const std::string& oldnick) CXX11_OVERRIDE { if (!tracknick) diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index f13ea48ea..5805d4bad 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "modules/ctctags.h" class DelayMsgMode : public ParamMode<DelayMsgMode, LocalIntExt> { @@ -44,18 +45,26 @@ class DelayMsgMode : public ParamMode<DelayMsgMode, LocalIntExt> } }; -class ModuleDelayMsg : public Module +class ModuleDelayMsg + : public Module + , public CTCTags::EventListener { + private: DelayMsgMode djm; bool allownotice; + ModResult HandleMessage(User* user, const MessageTarget& target, bool notice); + public: - ModuleDelayMsg() : djm(this) + ModuleDelayMsg() + : CTCTags::EventListener(this) + , djm(this) { } Version GetVersion() CXX11_OVERRIDE; void OnUserJoin(Membership* memb, bool sync, bool created, CUList&) CXX11_OVERRIDE; ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE; + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE; void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE; }; @@ -95,10 +104,20 @@ void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CULis ModResult ModuleDelayMsg::OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) { + return HandleMessage(user, target, details.type == MSG_NOTICE); +} + +ModResult ModuleDelayMsg::OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) +{ + return HandleMessage(user, target, false); +} + +ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target, bool notice) +{ if (!IS_LOCAL(user)) return MOD_RES_PASSTHRU; - if ((target.type != MessageTarget::TYPE_CHANNEL) || ((!allownotice) && (details.type == MSG_NOTICE))) + if ((target.type != MessageTarget::TYPE_CHANNEL) || ((!allownotice) && (notice))) return MOD_RES_PASSTHRU; Channel* channel = target.Get<Channel>(); diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index af976afd5..b2c67d538 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -24,6 +24,7 @@ #include "inspircd.h" +#include "modules/ctctags.h" #include "modules/exemption.h" /** Holds flood settings and state for mode +f @@ -105,20 +106,23 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> > } }; -class ModuleMsgFlood : public Module +class ModuleMsgFlood + : public Module + , public CTCTags::EventListener { +private: CheckExemption::EventProvider exemptionprov; MsgFlood mf; public: - ModuleMsgFlood() - : exemptionprov(this) + : CTCTags::EventListener(this) + , exemptionprov(this) , mf(this) { } - ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + ModResult HandleMessage(User* user, const MessageTarget& target) { if (target.type != MessageTarget::TYPE_CHANNEL) return MOD_RES_PASSTHRU; @@ -157,6 +161,16 @@ class ModuleMsgFlood : public Module return MOD_RES_PASSTHRU; } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + void Prioritize() CXX11_OVERRIDE { // we want to be after all modules that might deny the message (e.g. m_muteban, m_noctcp, m_blockcolor, etc.) diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 61d592b2b..5a8d60f2a 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -19,13 +19,21 @@ #include "inspircd.h" +#include "modules/ctctags.h" -class ModuleQuietBan : public Module +class ModuleQuietBan + : public Module + , public CTCTags::EventListener { private: bool notifyuser; public: + ModuleQuietBan() + : CTCTags::EventListener(this) + { + } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("muteban"); @@ -37,7 +45,7 @@ class ModuleQuietBan : public Module return Version("Implements extban +b m: - mute bans",VF_OPTCOMMON|VF_VENDOR); } - ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + ModResult HandleMessage(User* user, const MessageTarget& target, bool& echo_original) CXX11_OVERRIDE { if (!IS_LOCAL(user) || target.type != MessageTarget::TYPE_CHANNEL) return MOD_RES_PASSTHRU; @@ -47,7 +55,7 @@ class ModuleQuietBan : public Module { if (!notifyuser) { - details.echo_original = true; + echo_original = true; return MOD_RES_DENY; } @@ -58,6 +66,16 @@ class ModuleQuietBan : public Module return MOD_RES_PASSTHRU; } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target, details.echo_original); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target, details.echo_original); + } + void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE { tokens["EXTBAN"].push_back('m'); diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 16a9bae86..d5d9c818c 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -20,11 +20,14 @@ #include "inspircd.h" +#include "modules/ctctags.h" -class ModuleRestrictMsg : public Module +class ModuleRestrictMsg + : public Module + , public CTCTags::EventListener { - public: - ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + private: + ModResult HandleMessage(User* user, const MessageTarget& target) { if ((target.type == MessageTarget::TYPE_USER) && (IS_LOCAL(user))) { @@ -47,6 +50,22 @@ class ModuleRestrictMsg : public Module return MOD_RES_PASSTHRU; } + public: + ModuleRestrictMsg() + : CTCTags::EventListener(this) + { + } + + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Forbids users from messaging each other. Users may still message opers and opers may message other opers.",VF_VENDOR); diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 08a29f27d..2fb7b0852 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" #include "modules/account.h" #include "modules/callerid.h" +#include "modules/ctctags.h" #include "modules/exemption.h" #include "modules/whois.h" @@ -136,7 +137,10 @@ class AccountExtItemImpl : public AccountExtItem } }; -class ModuleServicesAccount : public Module, public Whois::EventListener +class ModuleServicesAccount + : public Module + , public Whois::EventListener + , public CTCTags::EventListener { private: CallerID::API calleridapi; @@ -152,6 +156,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener public: ModuleServicesAccount() : Whois::EventListener(this) + , CTCTags::EventListener(this) , calleridapi(this) , exemptionprov(this) , m1(this, "reginvite", 'R') @@ -194,7 +199,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener m5.RemoveMode(user); } - ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + ModResult HandleMessage(User* user, const MessageTarget& target) CXX11_OVERRIDE { if (!IS_LOCAL(user)) return MOD_RES_PASSTHRU; @@ -232,6 +237,16 @@ class ModuleServicesAccount : public Module, public Whois::EventListener return MOD_RES_PASSTHRU; } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) CXX11_OVERRIDE { if (checking_ban) diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index f162ceb87..5c436b116 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -23,6 +23,7 @@ #include "inspircd.h" +#include "modules/ctctags.h" #include "modules/ssl.h" enum @@ -134,7 +135,9 @@ class SSLModeUser : public ModeHandler } }; -class ModuleSSLModes : public Module +class ModuleSSLModes + : public Module + , public CTCTags::EventListener { private: UserCertificateAPI api; @@ -143,7 +146,8 @@ class ModuleSSLModes : public Module public: ModuleSSLModes() - : api(this) + : CTCTags::EventListener(this) + , api(this) , sslm(this, api) , sslquery(this, api) { @@ -169,7 +173,7 @@ class ModuleSSLModes : public Module return MOD_RES_PASSTHRU; } - ModResult OnUserPreMessage(User* user, const MessageTarget& msgtarget, MessageDetails& details) CXX11_OVERRIDE + ModResult HandleMessage(User* user, const MessageTarget& msgtarget) { if (msgtarget.type != MessageTarget::TYPE_USER) return MOD_RES_PASSTHRU; @@ -203,6 +207,16 @@ class ModuleSSLModes : public Module return MOD_RES_PASSTHRU; } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + + ModResult OnUserPreTagMessage(User* user, const MessageTarget& target, CTCTags::TagMessageDetails& details) CXX11_OVERRIDE + { + return HandleMessage(user, target); + } + ModResult OnCheckBan(User *user, Channel *c, const std::string& mask) CXX11_OVERRIDE { if ((mask.length() > 2) && (mask[0] == 'z') && (mask[1] == ':')) |