aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-01-19 11:40:15 +0000
committerGravatar Sadie Powell2022-01-19 11:44:35 +0000
commit28513865ce4960a7065f29de707ca2845dda12a1 (patch)
tree9eefe83f928dd1a9385cd5c39ce6ccb712094f60
parentMerge branch 'insp3' into master. (diff)
Fix aliases which require routing to be broadcast out.
-rw-r--r--include/command_parse.h14
-rw-r--r--src/modules/m_alias.cpp15
2 files changed, 17 insertions, 12 deletions
diff --git a/include/command_parse.h b/include/command_parse.h
index 74de719ae..e384e992a 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -37,13 +37,6 @@ class CoreExport CommandParser final
typedef std::unordered_map<std::string, Command*, irc::insensitive, irc::StrHashComp> CommandMap;
private:
- /** Process a command from a user.
- * @param user The user to parse the command for.
- * @param command The name of the command.
- * @param parameters The parameters to the command.
- */
- void ProcessCommand(LocalUser* user, std::string& command, CommandBase::Params& parameters);
-
/** Command list, a hash_map of command names to Command*
*/
CommandMap cmdlist;
@@ -119,6 +112,13 @@ class CoreExport CommandParser final
*/
void ProcessBuffer(LocalUser* user, const std::string& buffer);
+ /** Process a command from a user.
+ * @param user The user to parse the command for.
+ * @param command The name of the command.
+ * @param parameters The parameters to the command.
+ */
+ void ProcessCommand(LocalUser* user, std::string& command, CommandBase::Params& parameters);
+
/** Add a new command to the commands hash
* @param f The new Command to add to the list
* @return True if the command was added
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;
}