summaryrefslogtreecommitdiff
path: root/src/nickcore.cpp
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-02-04 23:49:27 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-02-04 23:49:27 +0000
commit308070e01971b0cfaf77de20011f48ce4d6b5a1c (patch)
tree2bdfd84e35cf79eb20dc2a79ddd233789ca84fdf /src/nickcore.cpp
parent3d4cf39940144be19645a3a7cdecf95213b96f26 (diff)
We now store a list of users using a NickCore in the NickCore, this prevents having to loop every user all the time to find them
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2780 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/nickcore.cpp')
-rw-r--r--src/nickcore.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/nickcore.cpp b/src/nickcore.cpp
index 0073e0d32..fc46cd6d4 100644
--- a/src/nickcore.cpp
+++ b/src/nickcore.cpp
@@ -38,20 +38,15 @@ NickCore::~NickCore()
/* Clean up this nick core from any users online using it
* (ones that /nick but remain unidentified)
*/
- User *user;
- for (int i = 0; i < 1024; ++i)
+ for (std::list<User *>::iterator it = this->Users.begin(); it != this->Users.end(); ++it)
{
- for (user = userlist[i]; user; user = user->next)
- {
- if (user->nc && user->nc == this)
- {
- ircdproto->SendAccountLogout(user, user->nc);
- ircdproto->SendUnregisteredNick(user);
- user->nc = NULL;
- FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
- }
- }
+ User *user = *it;
+ ircdproto->SendAccountLogout(user, user->Account());
+ ircdproto->SendUnregisteredNick(user);
+ user->Logout();
+ FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
}
+ this->Users.clear();
/* (Hopefully complete) cleanup */
cs_remove_nick(this);