]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockamsg.cpp
Mode +b stuff, probably wont work yet
[user/henk/code/inspircd.git] / src / modules / m_blockamsg.cpp
index a0ec7b5845d8721ac09876e4485b48b42f4e4668..0472e2417efbbeac8d3bafffe6a718eb001b82c1 100644 (file)
@@ -14,6 +14,8 @@
  *
  * ---------------------------------------------------
  */
+/* <3's to Lauren for original info on mIRC's weird behaviour */
 
 #include <string>
 #include <time.h>
@@ -68,7 +70,7 @@ public:
                return Version(1,0,0,0,VF_VENDOR);
        }
        
-       virtual void OnRehash(std::string parameter)
+       virtual void OnRehash(const std::string &parameter)
        {
                ConfigReader* Conf = new ConfigReader;
                
@@ -89,10 +91,10 @@ public:
                else
                        action = IBLOCK_KILLOPERS;
 
-               delete Conf;
+               DELETE(Conf);
        }
 
-       virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user, bool validated)
+       virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated)
        {
                // Don't do anything with unregistered users, or remote ones.
                if(!user || (user->registered != 7) || !IS_LOCAL(user))
@@ -119,8 +121,8 @@ public:
                                if((*c == ',') && *(c+1) && (*(c+1) == '#'))
                                        targets++;
                                        
-                       for(unsigned int i = 0; i < user->chans.size(); i++)
-                               if(user->chans[i].channel)
+                       for(std::vector<ucrec*>::iterator f = user->chans.begin(); f != user->chans.end(); f++)
+                               if(((ucrec*)(*f))->channel)
                                        userchans++;
 
                        // Check that this message wasn't already sent within a few seconds.
@@ -169,7 +171,7 @@ public:
                        BlockedMessage* m = (BlockedMessage*)user->GetExt("amsgblock");
                        if(m)
                        {
-                               delete m;
+                               DELETE(m);
                                user->Shrink("amsgblock");
                        }
                }
@@ -199,4 +201,3 @@ extern "C" void * init_module( void )
 {
        return new ModuleBlockAmsgFactory;
 }
-