summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-10 22:56:09 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-03-10 22:56:09 +0000
commit875b54b33c2063378aaefae58d70a99656e1bf24 (patch)
tree6485179c226207c541d98bcce514e629704aeee3 /src
parent516825e9ddd5f91359ac3cca51e8d8e9070dc96f (diff)
Fix fast quit/connect by changing nick to UID on QuitUser
This requires moving the sending of the QUIT back to usermanager from cull_list in order to prevent client desyncs. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11203 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cull_list.cpp25
-rw-r--r--src/usermanager.cpp21
2 files changed, 25 insertions, 21 deletions
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index abefa8b57..95301f3e2 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -42,13 +42,8 @@ int CullList::Apply()
std::vector<User *>::iterator a = list.begin();
User *u = (*a);
- user_hash::iterator iter = ServerInstance->Users->clientlist->find(u->nick);
- const std::string& preset_reason = u->GetOperQuit();
- std::string reason;
- std::string oper_reason;
-
- reason.assign(u->quitmsg, 0, ServerInstance->Config->Limits.MaxQuit);
- oper_reason.assign(preset_reason.empty() ? preset_reason : u->operquitmsg, 0, ServerInstance->Config->Limits.MaxQuit);
+ // user has been moved onto their UID; that's why this isn't find(u->nick)
+ user_hash::iterator iter = ServerInstance->Users->clientlist->find(u->uuid);
if (u->registered != REG_ALL)
if (ServerInstance->Users->unregistered_count)
@@ -58,19 +53,7 @@ int CullList::Apply()
{
if (!u->sendq.empty())
u->FlushWriteBuf();
- }
- if (u->registered == REG_ALL)
- {
- FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(u, reason, oper_reason));
- u->PurgeEmptyChannels();
- u->WriteCommonQuit(reason, oper_reason);
- }
-
- FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(u));
-
- if (IS_LOCAL(u))
- {
if (u->GetIOHook())
{
try
@@ -97,14 +80,14 @@ int CullList::Apply()
{
if (!u->quietquit)
{
- ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]", u->nick.c_str(), u->ident.c_str(), u->host.c_str(), oper_reason.c_str());
+ ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]", u->nick.c_str(), u->ident.c_str(), u->host.c_str(), u->operquitmsg.c_str());
}
}
else
{
if ((!ServerInstance->SilentULine(u->server)) && (!u->quietquit))
{
- ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]", u->server, u->nick.c_str(), u->ident.c_str(), u->host.c_str(), oper_reason.c_str());
+ ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]", u->server, u->nick.c_str(), u->ident.c_str(), u->host.c_str(), u->operquitmsg.c_str());
}
}
u->AddToWhoWas();
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index f8b1f0de2..cf068171d 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -184,12 +184,33 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char
user->quietquit = false;
user->quitmsg = quitreason;
+ std::string reason;
+ std::string oper_reason;
+ reason.assign(quitreason, 0, ServerInstance->Config->Limits.MaxQuit);
if (!*operreason)
+ {
user->operquitmsg = quitreason;
+ oper_reason.assign(quitreason, 0, ServerInstance->Config->Limits.MaxQuit);
+ }
else
+ {
user->operquitmsg = operreason;
+ oper_reason.assign(operreason, 0, ServerInstance->Config->Limits.MaxQuit);
+ }
ServerInstance->GlobalCulls.AddItem(user);
+
+ if (user->registered == REG_ALL)
+ {
+ FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(user, reason, oper_reason));
+ user->PurgeEmptyChannels();
+ user->WriteCommonQuit(reason, oper_reason);
+ }
+
+ 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());
}