From c5c5a867d29c98c73e4f9cc67841617c2598a320 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 14 Aug 2018 23:22:14 +0100 Subject: Fix aliases that resolve to messages echoing with echo-message. Fixes #1459. --- src/modules/m_alias.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/modules/m_alias.cpp') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 935cb8259..6f27ecc09 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -68,6 +68,9 @@ class ModuleAlias : public Module bool AllowBots; UserModeReference botmode; + // Whether we are actively executing an alias. + bool active; + public: void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { @@ -177,6 +180,15 @@ class ModuleAlias : public Module return MOD_RES_PASSTHRU; } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE + { + // Don't echo anything which is caused by an alias. + if (active) + details.echo = false; + + return MOD_RES_PASSTHRU; + } + void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE { if ((target.type != MessageTarget::TYPE_CHANNEL) || (details.type != MSG_PRIVMSG)) @@ -351,7 +363,10 @@ class ModuleAlias : public Module { pars.push_back(token); } + + active = true; ServerInstance->Parser.CallHandler(command, pars, user); + active = false; } void Prioritize() CXX11_OVERRIDE -- cgit v1.2.3