summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_alias.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index e8e7cec1a..ffa6c1e46 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -43,6 +43,7 @@ class ModuleAlias : public Module
private:
/** We cant use a map, there may be multiple aliases with the same name */
std::vector<Alias> Aliases;
+ std::map<std::string, int> AliasMap;
std::vector<std::string> pars;
virtual void ReadAliases()
@@ -50,6 +51,7 @@ class ModuleAlias : public Module
ConfigReader MyConf(ServerInstance);
Aliases.clear();
+ AliasMap.clear();
for (int i = 0; i < MyConf.Enumerate("alias"); i++)
{
Alias a;
@@ -62,6 +64,7 @@ class ModuleAlias : public Module
a.operonly = MyConf.ReadFlag("alias", "operonly", i);
a.format = MyConf.ReadValue("alias", "format", i);
Aliases.push_back(a);
+ AliasMap[txt] = 1;
}
}
@@ -132,11 +135,14 @@ class ModuleAlias : public Module
{
userrec *u = NULL;
- /* If the command is valid, we dont want to know,
- * and if theyre not registered yet, we dont want
- * to know either
+ /* If theyre not registered yet, we dont want
+ * to know.
*/
- if ((validated) || (user->registered != REG_ALL))
+ if (user->registered != REG_ALL)
+ return 0;
+
+ /* We dont have any commands looking like this, dont bother with the loop */
+ if (AliasMap.find(command) == AliasMap.end())
return 0;
irc::string c = command.c_str();