]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_alias.cpp
kick_channel -> chanrec::KickUser(), server_kick_channel -> chanrec::ServerKickUser()
[user/henk/code/inspircd.git] / src / modules / m_alias.cpp
index 3c4cac9afd0cf34fe5e13af3dfae10af20871e62..93df8e03167528cded7c1d6628227520f95b3872 100644 (file)
@@ -2,7 +2,7 @@
  *   | Inspire Internet Relay Chat Daemon |
  *   +------------------------------------+
  *
- *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
  *   E-mail:
  *     <brain@chatspike.net>
  *     <Craig@chatspike.net>
@@ -24,7 +24,7 @@ using namespace std;
 
 /* $ModDesc: Provides aliases of commands. */
 
-class Alias
+class Alias : public classbase
 {
        public:
                irc::string text;
@@ -79,7 +79,7 @@ class ModuleAlias : public Module
        
                virtual ~ModuleAlias()
                {
-                       delete MyConf;
+                       DELETE(MyConf);
                }
        
                virtual Version GetVersion()
@@ -87,13 +87,16 @@ class ModuleAlias : public Module
                        return Version(1,0,0,1,VF_VENDOR);
                }
 
-               virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user, bool validated)
+               virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated)
                {
                        userrec *u = NULL;
                        irc::string c = command.c_str();
 
-                       /* If the command is valid, we dont want to know */
-                       if (validated)
+                       /* If the command is valid, we dont want to know,
+                        * and if theyre not registered yet, we dont want
+                        * to know either
+                        */
+                       if ((validated) || (user->registered != REG_ALL))
                                return 0;
                        
                        for (unsigned int i = 0; i < Aliases.size(); i++)
@@ -109,7 +112,7 @@ class ModuleAlias : public Module
                                                        return 1;
                                                }
                                        }
-                                       if (Aliases[i].uline)
+                                       if ((u != NULL) && (Aliases[i].requires != "") && (Aliases[i].uline))
                                        {
                                                if (!Srv->IsUlined(u->server))
                                                {
@@ -134,9 +137,9 @@ class ModuleAlias : public Module
                                        stuff >> cmd;
                                        stuff >> target;
 
-                                       char* para[2];
-                                       para[0] = (char*)target.c_str();
-                                       para[1] = (char*)n.c_str();
+                                       const char* para[2];
+                                       para[0] = target.c_str();
+                                       para[1] = n.c_str();
 
                                        Srv->CallCommandHandler(cmd,para,2,user);
                                        return 1;
@@ -145,9 +148,9 @@ class ModuleAlias : public Module
                        return 0;
                }
   
-               virtual void OnRehash(std::string parameter)
+               virtual void OnRehash(const std::string &parameter)
                {
-                       delete MyConf;
+                       DELETE(MyConf);
                        MyConf = new ConfigReader;
                
                        ReadAliases();