diff options
author | linuxdaemon <linuxdaemon.irc@gmail.com> | 2019-09-14 13:00:44 -0500 |
---|---|---|
committer | P. Powell <petpow@saberuk.com> | 2019-09-14 21:18:46 +0100 |
commit | 436e358b5dc3de0e431ba9651ecf580d8ede2b06 (patch) | |
tree | 06b814aed3db263c3302807537df852fb661c8e3 /src | |
parent | 5a2af6ded883d71c6c4c9f1497cca1721f8b0742 (diff) |
m_alias: Add option to strip colors when matching
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_alias.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index a275853e9..577938e49 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -50,6 +50,9 @@ class Alias /** Format that must be matched for use */ std::string format; + + /** Strip color codes before match? */ + bool StripColor; }; class ModuleAlias : public Module @@ -94,6 +97,7 @@ class ModuleAlias : public Module a.UserCommand = tag->getBool("usercommand", true); a.OperOnly = tag->getBool("operonly"); a.format = tag->getString("format"); + a.StripColor = tag->getBool("stripcolor"); std::transform(a.AliasedCommand.begin(), a.AliasedCommand.end(), a.AliasedCommand.begin(), ::toupper); newAliases.insert(std::make_pair(a.AliasedCommand, a)); @@ -261,10 +265,14 @@ class ModuleAlias : public Module int DoAlias(User *user, Channel *c, Alias *a, const std::string& compare, const std::string& safe) { + std::string stripped(compare); + if (a->StripColor) + InspIRCd::StripColor(stripped); + /* Does it match the pattern? */ if (!a->format.empty()) { - if (!InspIRCd::Match(compare, a->format)) + if (!InspIRCd::Match(stripped, a->format)) return 0; } |