]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_timedbans.cpp
Resolve /STATS S conflict between SVSHOLD and SHUN
[user/henk/code/inspircd.git] / src / modules / m_timedbans.cpp
index b3b22786e84585219541f9ea1a27081d47e51cfd..ad6e8000b7c041a408b17b12dbd896aace422fb5 100644 (file)
@@ -133,32 +133,38 @@ class ModuleTimedBans : public Module
 
        virtual void OnBackgroundTimer(time_t curtime)
        {
+               timedbans expired;
                for (timedbans::iterator i = TimedBanList.begin(); i != TimedBanList.end();)
                {
                        if (curtime > i->expire)
                        {
-                               std::string chan = i->channel;
-                               std::string mask = i->mask;
-                               Channel* cr = ServerInstance->FindChan(chan);
+                               expired.push_back(*i);
                                i = TimedBanList.erase(i);
-                               if (cr)
-                               {
-                                       std::vector<std::string> setban;
-                                       setban.push_back(chan);
-                                       setban.push_back("-b");
-                                       setban.push_back(mask);
-
-                                       CUList empty;
-                                       std::string expiry = "*** Timed ban on " + chan + " expired.";
-                                       cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str());
-                                       ServerInstance->PI->SendChannelNotice(cr, '@', expiry);
-
-                                       ServerInstance->SendGlobalMode(setban, ServerInstance->FakeClient);
-                               }
                        }
                        else
                                ++i;
                }
+
+               for (timedbans::iterator i = expired.begin(); i != expired.end(); i++)
+               {
+                       std::string chan = i->channel;
+                       std::string mask = i->mask;
+                       Channel* cr = ServerInstance->FindChan(chan);
+                       if (cr)
+                       {
+                               std::vector<std::string> setban;
+                               setban.push_back(chan);
+                               setban.push_back("-b");
+                               setban.push_back(mask);
+
+                               CUList empty;
+                               std::string expiry = "*** Timed ban on " + chan + " expired.";
+                               cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str());
+                               ServerInstance->PI->SendChannelNotice(cr, '@', expiry);
+
+                               ServerInstance->SendGlobalMode(setban, ServerInstance->FakeClient);
+                       }
+               }
        }
 
        virtual Version GetVersion()