]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_remove.cpp
Added a parameter to OnRehash for the rehash parameter
[user/henk/code/inspircd.git] / src / modules / m_remove.cpp
index 31949ab24f5bc1987c2f0a64d524c9d69f82aaa7..a3aafdab0596887dcecb8e81f5d4788e3b7b2838 100644 (file)
@@ -1,6 +1,8 @@
 /* Support for a dancer-style /remove command, an alternative to /kick to try and avoid auto-rejoin-on-kick scripts */
 /* Written by Om, 25-03-05 */
 
+using namespace std;
+
 #include <stdio.h>
 #include <string>
 #include "users.h"
 Server *Srv;
 
 /* This little function just converts a chanmode character (~ & @ & +) into an integer (5 4 3 2 1) */
+/* XXX - this could be handy in the core, so it can be used elsewhere */
 int chartolevel(std::string privs)
 {
-       int level;
-       if(privs == "~")
-               level = 5;
-       else
-       if(privs == "&")
-               level = 4;
-       else
-       if(privs == "@")
-               level = 3;
+       /* XXX - if we just passed this a char, we could do a switch. Look nicer, really. */
+
+       if (privs == "~")
+               return 5;
+       else if (privs == "&")
+               return 4;
+       else if (privs == "@")
+               return 3;
+       else if (privs == "%")
+               return 2;
        else
-       if(privs == "%") {
-               level = 2;
-       } else {
-               level = 1;
-       }
-       return level;
+               return 1;
 }
         
 void handle_remove(char **parameters, int pcnt, userrec *user)
@@ -63,7 +62,7 @@ void handle_remove(char **parameters, int pcnt, userrec *user)
        /* If the target nick exists... */
        if (target && channel)
        {
-               for (int x = 0; x < strlen(parameters[1]); x++)
+               for (unsigned int x = 0; x < strlen(parameters[1]); x++)
                {
                                if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
                                {
@@ -97,10 +96,14 @@ void handle_remove(char **parameters, int pcnt, userrec *user)
                                Srv->PartUserFromChannel(target,std::string(parameters[1]), "Remove by "+std::string(user->nick)+":"+result);
                                Srv->SendTo(NULL,user,"NOTICE "+std::string(channel->name)+" : "+std::string(user->nick)+" removed "+std::string(target->nick)+ " from the channel");
                                Srv->SendTo(NULL,target,"NOTICE "+std::string(target->nick)+" :*** "+std::string(user->nick)+" removed you from "+std::string(channel->name)+" with the message:"+std::string(result));
-                       } else {
+                       }
+                       else
+                       {
                                Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** You do not have access to remove "+std::string(target->nick)+" from the "+std::string(channel->name));
                        }
-               } else {
+               }
+               else
+               {
                        Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** You do not have access to use /remove on "+std::string(channel->name));
                }
        }
@@ -128,7 +131,7 @@ class ModuleRemove : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,0,0);
+               return Version(1,0,0,1,VF_VENDOR);
        }
        
 };