From e3939559e4496c520ec29ad16a5cab99efe7257e Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 2 Dec 2012 17:54:23 +0100 Subject: m_kicknorejoin Minor improvements - Ignore remote users - Remove expired items in one pass --- src/modules/m_kicknorejoin.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 836f92e6c..6d2d10c84 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -81,9 +81,7 @@ public: delaylist* dl = kr.ext.get(chan); if (dl) { - std::vector itemstoremove; - - for (delaylist::iterator iter = dl->begin(); iter != dl->end(); iter++) + for (delaylist::iterator iter = dl->begin(); iter != dl->end(); ) { if (iter->second > ServerInstance->Time()) { @@ -94,17 +92,15 @@ public: user->nick.c_str(), chan->name.c_str(), modeparam.c_str()); return MOD_RES_DENY; } + ++iter; } else { // Expired record, remove. - itemstoremove.push_back(iter->first); + dl->erase(iter++); } } - for (unsigned int i = 0; i < itemstoremove.size(); i++) - dl->erase(itemstoremove[i]); - if (!dl->size()) kr.ext.unset(chan); } @@ -114,7 +110,7 @@ public: void OnUserKick(User* source, Membership* memb, const std::string &reason, CUList& excepts) { - if (memb->chan->IsModeSet(&kr) && (source != memb->user)) + if (memb->chan->IsModeSet(&kr) && (IS_LOCAL(memb->user)) && (source != memb->user)) { delaylist* dl = kr.ext.get(memb->chan); if (!dl) -- cgit v1.2.3