diff options
author | Peter Powell <petpow@saberuk.com> | 2018-08-14 23:22:14 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-08-15 08:58:06 +0100 |
commit | c5c5a867d29c98c73e4f9cc67841617c2598a320 (patch) | |
tree | 430cb3cbb9e4bb5547eb5492ad2c9d1214b0fb16 /src/modules/m_alias.cpp | |
parent | be0c4f6a3c0e65435f211d817270073dce047396 (diff) |
Fix aliases that resolve to messages echoing with echo-message.
Fixes #1459.
Diffstat (limited to 'src/modules/m_alias.cpp')
-rw-r--r-- | src/modules/m_alias.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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 |