]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_safelist.cpp
Check for windows drive letters on the start of paths and treat them the same as...
[user/henk/code/inspircd.git] / src / modules / m_safelist.cpp
index 5c729327bedacfd3f9ed9a949a21f0a0753f65d9..2e0212ded7646355faf5ff07e52ee50f73600039 100644 (file)
@@ -61,7 +61,7 @@ class ModuleSafeList : public Module
  
        virtual Version GetVersion()
        {
-               return Version(1,1,0,0,VF_VENDOR,API_VERSION);
+               return Version(1,2,0,0,VF_VENDOR,API_VERSION);
        }
  
 
@@ -69,7 +69,7 @@ class ModuleSafeList : public Module
         * OnPreCommand()
         *   Intercept the LIST command.
         */ 
-       virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line)
+       virtual int OnPreCommand(const std::string &command, const std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
        {
                /* If the command doesnt appear to be valid, we dont want to mess with it. */
                if (!validated)
@@ -77,7 +77,7 @@ class ModuleSafeList : public Module
  
                if (command == "LIST")
                {
-                       return this->HandleList(parameters, pcnt, user);
+                       return this->HandleList(parameters, user);
                }
                return 0;
        }
@@ -86,8 +86,9 @@ class ModuleSafeList : public Module
         * HandleList()
         *   Handle (override) the LIST command.
         */
-       int HandleList(const char* const* parameters, int pcnt, User* user)
+       int HandleList(const std::vector<std::string> &parameters, User* user)
        {
+               int pcnt = parameters.size();
                int minusers = 0, maxusers = 0;
 
                if (global_listing >= LimitList && !IS_OPER(user))
@@ -111,15 +112,15 @@ class ModuleSafeList : public Module
                /* Work around mIRC suckyness. YOU SUCK, KHALED! */
                if (pcnt == 1)
                {
-                       if (*parameters[0] == '<')
+                       if (parameters[0][0] == '<')
                        {
-                               maxusers = atoi(parameters[0]+1);
+                               maxusers = atoi(parameters[0].c_str()+1);
                                ServerInstance->Logs->Log("m_safelist",DEBUG,"Max users: %d", maxusers);
                                pcnt = 0;
                        }
-                       else if (*parameters[0] == '>')
+                       else if (parameters[0][0] == '>')
                        {
-                               minusers = atoi(parameters[0]+1);
+                               minusers = atoi(parameters[0].c_str()+1);
                                ServerInstance->Logs->Log("m_safelist",DEBUG,"Min users: %d", minusers);
                                pcnt = 0;
                        }
@@ -182,22 +183,22 @@ class ModuleSafeList : public Module
                                        continue;
                                }
 
-                               if ((chan) && (chan->modes[CM_PRIVATE]))
+                               if ((chan) && (chan->modes[CM_PRIVATE]) && (!IS_OPER(user)))
                                {
                                        bool display = (match(chan->name, ld->glob.c_str()) || (*chan->topic && match(chan->topic, ld->glob.c_str())));
                                        if ((users) && (display))
                                        {
-                                               int counter = snprintf(buffer, MAXBUF, "322 %s *", user->nick);
+                                               int counter = snprintf(buffer, MAXBUF, "322 %s * %ld :", user->nick, users);
                                                amount_sent += counter + ServerNameSize;
                                                user->WriteServ(std::string(buffer));
                                        }
                                }
-                               else if ((chan) && (((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET]))) || (has_user)))
+                               else if ((chan) && ((((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET])))) || (has_user) || IS_OPER(user)))
                                {
                                        bool display = (match(chan->name, ld->glob.c_str()) || (*chan->topic && match(chan->topic, ld->glob.c_str())));
                                        if ((users) && (display))
                                        {
-                                               int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s",user->nick, chan->name, users, chan->ChanModes(has_user), chan->topic);
+                                               int counter = snprintf(buffer, MAXBUF, "322 %s %s %ld :[+%s] %s",user->nick, chan->name, users, chan->ChanModes(has_user || IS_OPER(user)), chan->topic);
                                                amount_sent += counter + ServerNameSize;
                                                user->WriteServ(std::string(buffer));
                                        }