/** Requires oper? */
bool OperOnly;
- /* is case sensitive params */
- bool CaseSensitive;
-
/* whether or not it may be executed via fantasy (default OFF) */
bool ChannelCommand;
{
ConfigTag* fantasy = ServerInstance->Config->ConfValue("fantasy");
AllowBots = fantasy->getBool("allowbots", false);
- std::string fpre = fantasy->getString("prefix");
- fprefix = fpre.empty() ? "!" : fpre;
+ fprefix = fantasy->getString("prefix", "!", 1, ServerInstance->Config->Limits.MaxLine);
Aliases.clear();
ConfigTagList tags = ServerInstance->Config->ConfTags("alias");
a.UserCommand = tag->getBool("usercommand", true);
a.OperOnly = tag->getBool("operonly");
a.format = tag->getString("format");
- a.CaseSensitive = tag->getBool("matchcase");
Aliases.insert(std::make_pair(a.AliasedCommand, a));
}
}
/* Does it match the pattern? */
if (!a->format.empty())
{
- if (a->CaseSensitive)
- {
- if (!InspIRCd::Match(compare, a->format, rfc_case_sensitive_map))
- return 0;
- }
- else
- {
- if (!InspIRCd::Match(compare, a->format))
- return 0;
- }
+ if (!InspIRCd::Match(compare, a->format))
+ return 0;
}
if ((a->OperOnly) && (!user->IsOper()))
User* u = ServerInstance->FindNick(a->RequiredNick);
if (!u)
{
- user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick + " :is currently unavailable. Please try again later.");
+ user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is currently unavailable. Please try again later.");
return 1;
}
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.");
+ user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is an imposter! Please inform an IRC operator as soon as possible.");
return 1;
}
}
if (crlf == std::string::npos)
{
- DoCommand(a->ReplaceFormat, user, c, safe);
+ DoCommand(a->ReplaceFormat, user, c, safe, a);
return 1;
}
else
std::string scommand;
while (commands.GetToken(scommand))
{
- DoCommand(scommand, user, c, safe);
+ DoCommand(scommand, user, c, safe, a);
}
return 1;
}
}
- void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string &original_line)
+ void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string &original_line, Alias* a)
{
std::string result;
result.reserve(newline.length());
result.append(user->dhost);
i += 5;
}
+ else if (!newline.compare(i, 12, "$requirement", 12))
+ {
+ result.append(a->RequiredNick);
+ i += 11;
+ }
else
result.push_back(c);
}
ServerInstance->Parser.CallHandler(command, pars, user);
}
- void Prioritize()
+ void Prioritize() CXX11_OVERRIDE
{
// Prioritise after spanningtree so that channel aliases show the alias before the effects.
Module* linkmod = ServerInstance->Modules->Find("m_spanningtree.so");