From 50d763ca7480ecd6df08e137c9f0b8ee286843c9 Mon Sep 17 00:00:00 2001 From: w00t Date: Sat, 2 May 2009 21:43:12 +0000 Subject: 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 --- src/modules/m_callerid.cpp | 42 +++++++++++++++++++++++------------------- 1 file 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::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::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) -- cgit v1.2.3