diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-12-02 17:54:23 +0100 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-16 13:15:51 +0200 |
commit | e3939559e4496c520ec29ad16a5cab99efe7257e (patch) | |
tree | cb77a3613465bae2a70af9cc5f7814668dbc9955 | |
parent | 45ec564b05a80a84ea55ad49989bbcc211e7ee87 (diff) |
m_kicknorejoin Minor improvements
- Ignore remote users
- Remove expired items in one pass
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 12 |
1 files 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<User*> 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) |