/** Format that must be matched for use */
std::string format;
+
+ /** Strip color codes before match? */
+ bool StripColor;
};
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));
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)
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;
}
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.");
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;
}
}