mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 11:39:02 -04:00
Correctly match alias formats (was backwards) and avoid going on to other aliases if none match. Fixes bug #668 reported by Ankit, thanks.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10953 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
399e941c22
commit
0268121676
@ -139,7 +139,7 @@ class ModuleAlias : public Module
|
||||
|
||||
virtual int OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
|
||||
{
|
||||
std::multimap<std::string, Alias>::iterator i;
|
||||
std::multimap<std::string, Alias>::iterator i, upperbound;
|
||||
|
||||
/* If theyre not registered yet, we dont want
|
||||
* to know.
|
||||
@ -151,6 +151,8 @@ class ModuleAlias : public Module
|
||||
i = Aliases.find(command);
|
||||
if (i == Aliases.end())
|
||||
return 0;
|
||||
/* Avoid iterating on to different aliases if no patterns match. */
|
||||
upperbound = Aliases.upper_bound(command);
|
||||
|
||||
irc::string c = command.c_str();
|
||||
/* The parameters for the command in their original form, with the command stripped off */
|
||||
@ -164,7 +166,7 @@ class ModuleAlias : public Module
|
||||
|
||||
SearchAndReplace(safe, "$", "\r");
|
||||
|
||||
while (i != Aliases.end())
|
||||
while (i != upperbound)
|
||||
{
|
||||
if (i->second.UserCommand)
|
||||
{
|
||||
@ -228,6 +230,9 @@ class ModuleAlias : public Module
|
||||
|
||||
if (i == Aliases.end())
|
||||
return 0;
|
||||
|
||||
/* Avoid iterating on to other aliases if no patterns match */
|
||||
std::multimap<std::string, Alias>::iterator upperbound = Aliases.upper_bound(fcommand);
|
||||
|
||||
|
||||
/* The parameters for the command in their original form, with the command stripped off */
|
||||
@ -242,7 +247,7 @@ class ModuleAlias : public Module
|
||||
|
||||
ServerInstance->Logs->Log("FANTASY", DEBUG, "fantasy: compare is %s and safe is %s", compare.c_str(), safe.c_str());
|
||||
|
||||
while (i != Aliases.end())
|
||||
while (i != upperbound)
|
||||
{
|
||||
if (i->second.ChannelCommand)
|
||||
{
|
||||
@ -266,12 +271,12 @@ class ModuleAlias : public Module
|
||||
{
|
||||
if (a->CaseSensitive)
|
||||
{
|
||||
if (InspIRCd::Match(compare, a->format, rfc_case_sensitive_map))
|
||||
if (!InspIRCd::Match(compare, a->format, rfc_case_sensitive_map))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InspIRCd::Match(compare, a->format))
|
||||
if (!InspIRCd::Match(compare, a->format))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user