]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/u_listmode.h
More comments
[user/henk/code/inspircd.git] / include / u_listmode.h
index d5770d9b746e2902498b9473d28af88dadaf1abc..a2a3940451ff3fd99216dce2000d299c5a9a2b31 100644 (file)
@@ -102,12 +102,11 @@ class ListModeBase : public ModeHandler
        {
                modelist* el;
                channel->GetExt(infokey, el);
-               irc::string csp(assign(parameter));
                if (el)
                {
                        for (modelist::iterator it = el->begin(); it != el->end(); it++)
                        {
-                               if(csp == it->mask)
+                               if(parameter == it->mask)
                                {
                                        return std::make_pair(true, parameter);
                                }
@@ -122,7 +121,7 @@ class ListModeBase : public ModeHandler
                channel->GetExt(infokey, el);
                if (el)
                {
-                       for(modelist::iterator it = el->begin(); it != el->end(); it++)
+                       for (modelist::reverse_iterator it = el->rbegin(); it != el->rend(); ++it)
                        {
                                user->WriteServ("%s %s %s %s %s %s", listnumeric.c_str(), user->nick, channel->name, it->mask.c_str(), it->nick.c_str(), it->time.c_str());
                        }
@@ -132,19 +131,17 @@ class ListModeBase : public ModeHandler
 
        virtual void RemoveMode(chanrec* channel)
        {
-               ServerInstance->Log(DEBUG,"Removing listmode base from %s %s",channel->name,infokey.c_str());
                modelist* el;
                channel->GetExt(infokey, el);
                if (el)
                {
-                       ServerInstance->Log(DEBUG,"Channel is extended with a list");
                        irc::modestacker modestack(false);
                        std::deque<std::string> stackresult;
-                       const char* mode_junk[MAXMODES+1];
+                       const char* mode_junk[MAXMODES+2];
                        mode_junk[0] = channel->name;
                        userrec* n = new userrec(ServerInstance);
                        n->SetFd(FD_MAGIC_NUMBER);
-                       for(modelist::iterator it = el->begin(); it != el->end(); it++)
+                       for (modelist::iterator it = el->begin(); it != el->end(); it++)
                        {
                                modestack.Push(this->GetModeChar(), assign(it->mask));
                        }
@@ -172,17 +169,17 @@ class ListModeBase : public ModeHandler
 
                chanlimits.clear();
 
-               for(int i = 0; i < Conf.Enumerate(configtag); i++)
+               for (int i = 0; i < Conf.Enumerate(configtag); i++)
                {
                        // For each <banlist> tag
                        ListLimit limit;
                        limit.mask = Conf.ReadValue(configtag, "chan", i);
                        limit.limit = Conf.ReadInteger(configtag, "limit", i, true);
 
-                       if(limit.mask.size() && limit.limit > 0)
+                       if (limit.mask.size() && limit.limit > 0)
                                chanlimits.push_back(limit);
                }
-               if(chanlimits.size() == 0)
+               if (chanlimits.size() == 0)
                {
                        ListLimit limit;
                        limit.mask = "*";
@@ -219,7 +216,7 @@ class ListModeBase : public ModeHandler
                        // Check if the item already exists in the list
                        for (modelist::iterator it = el->begin(); it != el->end(); it++)
                        {
-                               if(parameter == it->mask)
+                               if (parameter == it->mask)
                                {
                                        /* Give a subclass a chance to error about this */
                                        TellAlreadyOnList(source, channel, parameter);
@@ -249,7 +246,7 @@ class ListModeBase : public ModeHandler
                                                 * 2) 'fix' parameter and then allow
                                                 * 3) deny
                                                 */
-                                               if(ValidateParam(source, channel, parameter))
+                                               if (ValidateParam(source, channel, parameter))
                                                {
                                                        // And now add the mask onto the list...
                                                        ListItem e;
@@ -270,7 +267,7 @@ class ListModeBase : public ModeHandler
                        }
 
                        /* List is full, give subclass a chance to send a custom message */
-                       if(!TellListTooLong(source, channel, parameter))
+                       if (!TellListTooLong(source, channel, parameter))
                        {
                                source->WriteServ("478 %s %s %s :Channel ban/ignore list is full", source->nick, channel->name, parameter.c_str());
                        }
@@ -285,10 +282,10 @@ class ListModeBase : public ModeHandler
                        {
                                for (modelist::iterator it = el->begin(); it != el->end(); it++)
                                {
-                                       if(parameter == it->mask)
+                                       if (parameter == it->mask)
                                        {
                                                el->erase(it);
-                                               if(el->size() == 0)
+                                               if (el->size() == 0)
                                                {
                                                        channel->Shrink(infokey);
                                                        delete el;
@@ -375,3 +372,4 @@ class ListModeBase : public ModeHandler
 };
 
 #endif
+