+ oper_reason = quitreason;
+
+ ServerInstance->GlobalCulls.AddItem(user);
+
+ if (user->registered == REG_ALL)
+ {
+ FOREACH_MOD(I_OnUserQuit,OnUserQuit(user, reason, oper_reason));
+ user->WriteCommonQuit(reason, oper_reason);
+ }
+
+ if (user->registered != REG_ALL)
+ if (ServerInstance->Users->unregistered_count)
+ ServerInstance->Users->unregistered_count--;
+
+ if (IS_LOCAL(user))
+ {
+ LocalUser* lu = IS_LOCAL(user);
+ FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(lu));
+ lu->eh.Close();
+ }
+
+ /*
+ * this must come before the ServerInstance->SNO->WriteToSnoMaskso that it doesnt try to fill their buffer with anything
+ * if they were an oper with +s +qQ.
+ */
+ if (user->registered == REG_ALL)
+ {
+ if (IS_LOCAL(user))
+ {
+ if (!user->quietquit)
+ {
+ ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s (%s) [%s]",
+ user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_reason.c_str());
+ }
+ }
+ else
+ {
+ if ((!ServerInstance->SilentULine(user->server)) && (!user->quietquit))
+ {
+ ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s (%s) [%s]",
+ user->server.c_str(), user->GetFullRealHost().c_str(), user->GetIPString().c_str(), oper_reason.c_str());
+ }
+ }
+ }
+
+ user_hash::iterator iter = this->clientlist->find(user->nick);
+
+ if (iter != this->clientlist->end())
+ this->clientlist->erase(iter);
+ else
+ ServerInstance->Logs->Log("USERS", LOG_DEBUG, "iter == clientlist->end, can't remove them from hash... problematic..");
+
+ ServerInstance->Users->uuidlist->erase(user->uuid);
+}
+
+
+void UserManager::AddLocalClone(User *user)
+{
+ local_clones[user->GetCIDRMask()]++;