X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_alias.cpp;h=7e8c79154e8f55cd3bfff1ad5cc9f882cd1bbe14;hb=4cc992f6c20354eef88b7652f268591daccb1b20;hp=a275853e951110f6737f3fcccd8e95e3e29a86d7;hpb=d2ebf5083be476d73f468e9f45e369576bd3df2c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index a275853e9..7e8c79154 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; } @@ -273,7 +281,7 @@ class ModuleAlias : public Module if (!a->RequiredNick.empty()) { - User* u = ServerInstance->FindNick(a->RequiredNick); + User* u = ServerInstance->FindNickOnly(a->RequiredNick); if (!u) { user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is currently unavailable. Please try again later.");