diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-05-02 21:43:12 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-05-02 21:43:12 +0000 |
commit | 50d763ca7480ecd6df08e137c9f0b8ee286843c9 (patch) | |
tree | a473c52c31caf0fa9b140c3fb978cd8f484b3b84 /src/modules | |
parent | b0884a94ef85f28fa964adc1b4f0732f2986ca7a (diff) |
Minor cleanup: move RemoveFromAllAccepts() to a private class method
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11353 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_callerid.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 359276768..80694307e 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -96,23 +96,6 @@ void RemoveData(User* who) delete dat; } -void RemoveFromAllAccepts(InspIRCd* ServerInstance, User* who) -{ - for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); ++i) - { - callerid_data* dat = GetData(i->second, false); - - if (!dat) - continue; - - std::set<User*>::iterator iter = dat->accepting.find(who); - - if (iter == dat->accepting.end()) - continue; - - dat->accepting.erase(iter); - } -} class User_g : public SimpleUserModeHandler { @@ -281,6 +264,27 @@ private: bool tracknick; // Allow ACCEPT entries to update with nick changes. unsigned int notify_cooldown; // Seconds between notifications. + /** Removes a user from all accept lists + * @param who The user to remove from accepts + */ + void RemoveFromAllAccepts(User* who) + { + for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); ++i) + { + callerid_data* dat = GetData(i->second, false); + + if (!dat) + continue; + + std::set<User*>::iterator iter = dat->accepting.find(who); + + if (iter == dat->accepting.end()) + continue; + + dat->accepting.erase(iter); + } + } + public: ModuleCallerID(InspIRCd* Me) : Module(Me) { @@ -407,14 +411,14 @@ public: virtual int OnUserPreNick(User* user, const std::string& newnick) { if (!tracknick) - RemoveFromAllAccepts(ServerInstance, user); + RemoveFromAllAccepts(user); return 0; } virtual void OnUserQuit(User* user, const std::string& message, const std::string& oper_message) { RemoveData(user); - RemoveFromAllAccepts(ServerInstance, user); + RemoveFromAllAccepts(user); } virtual void OnRehash(User* user, const std::string& parameter) |