]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/u_listmode.h
Add more features to modestacker so that we can stack +, -, and parameterless modes
[user/henk/code/inspircd.git] / include / u_listmode.h
index bc6a9fa2085af0323476933b5af6f068a4835b37..8315dbcd1e7e795bc38b5ade6544edc916aeca50 100644 (file)
@@ -107,7 +107,13 @@ class ListModeBase : public ModeHandler
                        char moderemove[MAXBUF];
                        userrec* n = new userrec(ServerInstance);
                        n->SetFd(FD_MAGIC_NUMBER);
+                       modelist copy;
+                       /* Make a copy of it, because we cant change the list whilst iterating over it */
                        for(modelist::iterator it = el->begin(); it != el->end(); it++)
+                       {
+                               copy.push_back(*it);
+                       }
+                       for(modelist::iterator it = copy.begin(); it != copy.end(); it++)
                        {
                                ServerInstance->Log(DEBUG,"Remove item %s",it->mask.c_str());
                                sprintf(moderemove,"-%c",this->GetModeChar());
@@ -252,18 +258,16 @@ class ListModeBase : public ModeHandler
                                                }
                                                return MODEACTION_ALLOW;
                                        }
-                                       else
-                                       {
-                                               /* Tried to remove something that wasn't set */
-                                               TellNotSet(source, channel, parameter);
-                                       }
                                }
+                               /* Tried to remove something that wasn't set */
+                               TellNotSet(source, channel, parameter);
                                parameter = "";
                                return MODEACTION_DENY;
                        }
                        else
                        {
-                               // Hmm, taking an exception off a non-existant list, DIE
+                               /* Hmm, taking an exception off a non-existant list, DIE */
+                               TellNotSet(source, channel, parameter);
                                parameter = "";
                                return MODEACTION_DENY;
                        }