]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_alias.cpp
Fix an shadowing warning in the spanningtree module.
[user/henk/code/inspircd.git] / src / modules / m_alias.cpp
index 4d1dd65c95576c1b34484e73b5f8c210da8d8566..577938e49613bf8fae252106b9de64f440095ebf 100644 (file)
@@ -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));
@@ -107,12 +111,13 @@ class ModuleAlias : public Module
 
        ModuleAlias()
                : botmode(this, "bot")
+               , active(false)
        {
        }
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides aliases of commands.", VF_VENDOR);
+               return Version("Provides aliases of commands", VF_VENDOR);
        }
 
        std::string GetVar(std::string varname, const std::string &original_line)
@@ -260,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;
                }
 
@@ -281,8 +290,8 @@ class ModuleAlias : public Module
 
                        if ((a->ULineOnly) && (!u->server->IsULine()))
                        {
-                               ServerInstance->SNO->WriteToSnoMask('a', "NOTICE -- Service "+a->RequiredNick+" required by alias "+a->AliasedCommand+" is not on a u-lined server, possibly underhanded antics detected!");
-                               user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is an imposter! Please inform an IRC operator as soon as possible.");
+                               ServerInstance->SNO->WriteToSnoMask('a', "NOTICE -- Service "+a->RequiredNick+" required by alias "+a->AliasedCommand+" is not on a U-lined server, possibly underhanded antics detected!");
+                               user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is not a network service! Please inform a server operator as soon as possible.");
                                return 1;
                        }
                }