summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_privmsg.cpp9
-rw-r--r--src/modules.cpp1
-rw-r--r--src/modules/m_ircv3_echomessage.cpp7
3 files changed, 17 insertions, 0 deletions
diff --git a/src/coremods/core_privmsg.cpp b/src/coremods/core_privmsg.cpp
index f1461df5f..6c5b7557e 100644
--- a/src/coremods/core_privmsg.cpp
+++ b/src/coremods/core_privmsg.cpp
@@ -99,7 +99,10 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, msgtarget, msgdetails));
if (MOD_RESULT == MOD_RES_DENY)
+ {
+ FOREACH_MOD(OnUserMessageBlocked, (user, msgtarget, msgdetails));
return CMD_FAILURE;
+ }
FOREACH_MOD(OnUserMessage, (user, msgtarget, msgdetails));
if (InspIRCd::Match(ServerInstance->Config->ServerName, servername, NULL))
@@ -155,7 +158,10 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, msgtarget, msgdetails));
if (MOD_RESULT == MOD_RES_DENY)
+ {
+ FOREACH_MOD(OnUserMessageBlocked, (user, msgtarget, msgdetails));
return CMD_FAILURE;
+ }
/* Check again, a module may have zapped the input string */
if (msgdetails.text.empty())
@@ -231,7 +237,10 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, msgtarget, msgdetails));
if (MOD_RESULT == MOD_RES_DENY)
+ {
+ FOREACH_MOD(OnUserMessageBlocked, (user, msgtarget, msgdetails));
return CMD_FAILURE;
+ }
FOREACH_MOD(OnUserMessage, (user, msgtarget, msgdetails));
diff --git a/src/modules.cpp b/src/modules.cpp
index 5f8439c44..9359cac37 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -113,6 +113,7 @@ ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { Detach
ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { DetachEvent(I_OnPassCompare); return MOD_RES_PASSTHRU; }
void Module::OnPostConnect(User*) { DetachEvent(I_OnPostConnect); }
void Module::OnUserPostMessage(User*, const MessageTarget&, const MessageDetails&) { DetachEvent(I_OnUserPostMessage); }
+void Module::OnUserMessageBlocked(User*, const MessageTarget&, const MessageDetails&) { DetachEvent(I_OnUserMessageBlocked); }
void Module::OnUserInvite(User*, User*, Channel*, time_t, unsigned int, CUList&) { DetachEvent(I_OnUserInvite); }
void Module::OnPostTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPostTopicChange); }
void Module::OnDecodeMetaData(Extensible*, const std::string&, const std::string&) { DetachEvent(I_OnDecodeMetaData); }
diff --git a/src/modules/m_ircv3_echomessage.cpp b/src/modules/m_ircv3_echomessage.cpp
index c2818700f..056b02194 100644
--- a/src/modules/m_ircv3_echomessage.cpp
+++ b/src/modules/m_ircv3_echomessage.cpp
@@ -61,6 +61,13 @@ class ModuleIRCv3EchoMessage : public Module
user->WriteFrom(user, msg);
}
+ void OnUserMessageBlocked(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE
+ {
+ // Prevent spammers from knowing that their spam was blocked.
+ if (details.echooriginal)
+ OnUserPostMessage(user, target, details);
+ }
+
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides the echo-message IRCv3.2 extension", VF_VENDOR);