X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=b5050d91a56c4a17bda9be5cf9628b74741193be;hb=48869b38e938de4d8dd4cdff486b10348e81f7b6;hp=745934fd4467efc78db9c0b325d068aa7f98cc83;hpb=d736eba00b274c87662bd73a3acf8288135643d6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 745934fd4..b5050d91a 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -28,7 +28,7 @@ UserManager::UserManager() : clientlist(new user_hash) , uuidlist(new user_hash) - , unregistered_count(0), local_count(0) + , unregistered_count(0) { } @@ -62,20 +62,9 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs } UserIOHandler* eh = &New->eh; - /* Give each of the modules an attempt to hook the user for I/O */ - FOREACH_MOD(OnHookIO, (eh, via)); - - if (eh->GetIOHook()) - { - try - { - eh->GetIOHook()->OnStreamSocketAccept(eh, client, server); - } - catch (CoreException& modexcept) - { - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "%s threw an exception: %s", modexcept.GetSource().c_str(), modexcept.GetReason().c_str()); - } - } + // If this listener has an IO hook provider set then tell it about the connection + if (via->iohookprov) + via->iohookprov->OnAccept(eh, client, server); ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New user fd: %d", socket); @@ -92,8 +81,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs ServerInstance->Users->AddLocalClone(New); ServerInstance->Users->AddGlobalClone(New); - New->localuseriter = this->local_users.insert(local_users.end(), New); - local_count++; + this->local_users.push_front(New); if ((this->local_users.size() > ServerInstance->Config->SoftLimit) || (this->local_users.size() >= (unsigned int)ServerInstance->SE->GetMaxFds())) { @@ -221,6 +209,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std: ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "ERROR: Nick not found in clientlist, cannot remove: " + user->nick); uuidlist->erase(user->uuid); + user->PurgeEmptyChannels(); } void UserManager::AddLocalClone(User *user)