]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/u_listmode.h
Remove an extern, partly because it's unused, partly because it then gets shadowed...
[user/henk/code/inspircd.git] / include / u_listmode.h
index b6cac9c5006e72eab3530a0563794f9172d967ce..a41f30e68e7356cfad423d77480e38a0077edf7f 100644 (file)
@@ -12,6 +12,7 @@
 
 /* $ModDesc: Provides support for easily creating listmodes, stores the time set, the user, and a parameter. */
 
+/* Updated to use the <banlist> config tag if it exists */
 /* Written by Om <omster@gmail.com>, December 2005. */
 /* Based on code previously written by Om - April 2005 */
 /* Originally based on m_chanprotect and m_silence */
@@ -38,14 +39,13 @@ public:
        unsigned int limit;
 };
 
-// Just defining the type we use for the excpetion list here...
+// Just defining the type we use for the exception list here...
 typedef std::vector<ListItem> modelist;
 typedef std::vector<ListLimit> limitlist;
 
 class ListModeBaseModule : public Module
 {
 protected:
-       int maxlist;
        char mode;
        std::string infokey;
        std::string listnumeric;
@@ -56,7 +56,7 @@ protected:
        Server* Srv;
        ConfigReader* Conf;
 public:
-       ListModeBaseModule(Server* serv, char modechar, std::string eolstr, std::string lnum, std::string eolnum) : Module::Module(serv)
+       ListModeBaseModule(Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum) : Module::Module(serv)
        {
                Srv = serv;
                Conf = new ConfigReader;
@@ -70,7 +70,7 @@ public:
                Srv->AddExtendedListMode(modechar);             
        }
        
-       virtual void OnRehash(std::string param)
+       virtual void OnRehash(const std::string &param)
        {
                delete Conf;
                Conf = new ConfigReader;
@@ -147,12 +147,15 @@ public:
                                        }
                                }
                                
+                               unsigned int maxsize = 0;
+                               
                                for(limitlist::iterator it = chanlimits.begin(); it != chanlimits.end(); it++)
                                {
                                        if(Srv->MatchText(chan->name, it->mask))
                                        {
                                                // We have a pattern matching the channel...
-                                               if(el->size() < it->limit)
+                                               maxsize = el->size();
+                                               if(maxsize < it->limit)
                                                {
                                                        // And now add the mask onto the list...
                                                        ListItem e;
@@ -169,7 +172,7 @@ public:
 
                                // List is full
                                WriteServ(user->fd, "478 %s %s %s :Channel ban/ignore list is full", user->nick, chan->name, params[0].c_str());
-                               log(DEBUG, "m_exceptionbase.so: %s tried to set mask %s on %s but the list is full (max %d)", user->nick, params[0].c_str(), chan->name, maxlist);
+                               log(DEBUG, "m_exceptionbase.so: %s tried to set mask %s on %s but the list is full (max %d)", user->nick, params[0].c_str(), chan->name, maxsize);
                                return -1;
                        }
                        else