summaryrefslogtreecommitdiff
path: root/src/usermanager.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:50:12 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:50:12 +0000
commitdb7cc57f444a82df65f47b4f7058560e645e35cf (patch)
treea56309d5d5ae0dec214f2d45a2852f2bd1cf2b02 /src/usermanager.cpp
parent3999c2eccf43c998e70d49023d8f35e3fa1632c8 (diff)
Move user quit logic out of cull list
This changes the cull list from a list of User* that ran special cleanup to a list of classbase* that simply deletes the objects. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11636 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r--src/usermanager.cpp67
1 files changed, 66 insertions, 1 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index a31ac086e..31ffad007 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -204,8 +204,73 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char
FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(user));
- // Move the user onto their UID, to allow nick to be reused immediately
user->UpdateNickHash(user->uuid.c_str());
+
+ user_hash::iterator iter = this->clientlist->find(user->uuid);
+
+ if (user->registered != REG_ALL)
+ if (ServerInstance->Users->unregistered_count)
+ ServerInstance->Users->unregistered_count--;
+
+ if (IS_LOCAL(user))
+ {
+ if (!user->sendq.empty())
+ user->FlushWriteBuf();
+
+ if (user->GetIOHook())
+ {
+ try
+ {
+ user->GetIOHook()->OnRawSocketClose(user->GetFd());
+ }
+ catch (CoreException& modexcept)
+ {
+ ServerInstance->Logs->Log("USERS",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ }
+ }
+
+ ServerInstance->SE->DelFd(user);
+ user->CloseSocket();
+ }
+
+ /*
+ * this must come before the ServerInstance->SNO->WriteToSnoMaskso that it doesnt try to fill their buffer with anything
+ * if they were an oper with +sn +qQ.
+ */
+ if (user->registered == REG_ALL)
+ {
+ if (IS_LOCAL(user))
+ {
+ if (!user->quietquit)
+ {
+ ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]",
+ user->nick.c_str(), user->ident.c_str(), user->host.c_str(), user->operquitmsg.c_str());
+ }
+ }
+ else
+ {
+ if ((!ServerInstance->SilentULine(user->server)) && (!user->quietquit))
+ {
+ ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]",
+ user->server, user->nick.c_str(), user->ident.c_str(), user->host.c_str(), user->operquitmsg.c_str());
+ }
+ }
+ user->AddToWhoWas();
+ }
+
+ if (iter != this->clientlist->end())
+ this->clientlist->erase(iter);
+ else
+ ServerInstance->Logs->Log("USERS", DEBUG, "iter == clientlist->end, can't remove them from hash... problematic..");
+
+ if (IS_LOCAL(user))
+ {
+ std::vector<User*>::iterator x = find(local_users.begin(),local_users.end(),user);
+ if (x != local_users.end())
+ local_users.erase(x);
+ else
+ ServerInstance->Logs->Log("USERS", DEBUG, "Failed to remove user from vector");
+ }
}