]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_alias.cpp
m_spanningtree Remove SpanningTreeUtilities* fields and parameters
[user/henk/code/inspircd.git] / src / modules / m_alias.cpp
index 34f4c4f64e8d1f7d4792feef0dd8cf34647e2473..4d942854cbdeff85c5aa5dd2093a205a1ea37643 100644 (file)
@@ -22,8 +22,6 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Provides aliases of commands. */
-
 /** An alias definition
  */
 class Alias
@@ -69,6 +67,7 @@ class ModuleAlias : public Module
 
        /* whether or not +B users are allowed to use fantasy commands */
        bool AllowBots;
+       UserModeReference botmode;
 
        void ReadAliases()
        {
@@ -98,11 +97,14 @@ class ModuleAlias : public Module
        }
 
  public:
+       ModuleAlias()
+               : botmode(this, "bot")
+       {
+       }
+
        void init() CXX11_OVERRIDE
        {
                ReadAliases();
-               Implementation eventlist[] = { I_OnPreCommand, I_OnRehash, I_OnUserMessage };
-               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        Version GetVersion() CXX11_OVERRIDE
@@ -189,7 +191,7 @@ class ModuleAlias : public Module
                }
 
                /* Stop here if the user is +B and allowbot is set to no. */
-               if (!AllowBots && user->IsModeSet('B'))
+               if (!AllowBots && user->IsModeSet(botmode))
                {
                        return;
                }
@@ -244,7 +246,7 @@ class ModuleAlias : public Module
        }
 
 
-       int DoAlias(User *user, Channel *c, Alias *a, const std::string compare, const std::string safe)
+       int DoAlias(User *user, Channel *c, Alias *a, const std::string& compare, const std::string& safe)
        {
                User *u = NULL;
 
@@ -309,7 +311,7 @@ class ModuleAlias : public Module
        void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string &original_line)
        {
                std::string result;
-               result.reserve(MAXBUF);
+               result.reserve(newline.length());
                for (unsigned int i = 0; i < newline.length(); i++)
                {
                        char c = newline[i];