From 28513865ce4960a7065f29de707ca2845dda12a1 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 19 Jan 2022 11:40:15 +0000 Subject: Fix aliases which require routing to be broadcast out. --- src/modules/m_alias.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/modules/m_alias.cpp') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 4dc1aa477..4a5f24cf1 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -203,13 +203,18 @@ class ModuleAlias final void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) override { + // Don't allow aliases to trigger other aliases. + if (active) + return; + if ((target.type != MessageTarget::TYPE_CHANNEL) || (details.type != MSG_PRIVMSG)) { return; } // fcommands are only for local users. Spanningtree will send them back out as their original cmd. - if (!IS_LOCAL(user)) + LocalUser* luser = IS_LOCAL(user); + if (!luser) { return; } @@ -255,13 +260,13 @@ class ModuleAlias final if (alias.ChannelCommand) { // We use substr here to remove the fantasy prefix - if (DoAlias(user, c, alias, compare, details.text.substr(fprefix.size()))) + if (DoAlias(luser, c, alias, compare, details.text.substr(fprefix.size()))) return; } } } - int DoAlias(User *user, Channel *c, const Alias& a, const std::string& compare, const std::string& safe) + int DoAlias(LocalUser* user, Channel* c, const Alias& a, const std::string& compare, const std::string& safe) { std::string stripped(compare); if (a.StripColor) @@ -316,7 +321,7 @@ class ModuleAlias final } } - void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string& original_line, const Alias& a) + void DoCommand(const std::string& newline, LocalUser* user, Channel* chan, const std::string& original_line, const Alias& a) { std::string result; result.reserve(newline.length()); @@ -381,7 +386,7 @@ class ModuleAlias final } active = true; - ServerInstance->Parser.CallHandler(command, pars, user); + ServerInstance->Parser.ProcessCommand(user, command, pars); active = false; } -- cgit v1.3.1-10-gc9f91