summaryrefslogtreecommitdiff
path: root/src/usermanager.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-09 15:34:54 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-09 15:34:54 +0000
commitd7a0cd3db1e8b64a6f706f1831e645ad69aa7927 (patch)
tree16c271fcada893eb55778952251bd89ee836ae52 /src/usermanager.cpp
parent621de565e15f9301b1e735b4c758fb805da57d86 (diff)
Move QuitUser into UserManager class, and unstaticize it. This prepares for some benchmarking lulz on object pooling I plan to do today, as well as making more sense now we *have* a manager class
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9442 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/usermanager.cpp')
-rw-r--r--src/usermanager.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index ecbd683b7..6385fb929 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -96,7 +96,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac
if (!i)
{
- User::QuitUser(Instance, New, "Access denied by configuration");
+ this->QuitUser(New, "Access denied by configuration");
return;
}
@@ -111,7 +111,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac
if ((this->local_users.size() > Instance->Config->SoftLimit) || (this->local_users.size() >= (unsigned int)Instance->SE->GetMaxFds()))
{
Instance->SNO->WriteToSnoMask('A', "Warning: softlimit value has been reached: %d clients", Instance->Config->SoftLimit);
- User::QuitUser(Instance, New,"No more connections allowed");
+ this->QuitUser(New,"No more connections allowed");
return;
}
@@ -127,7 +127,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac
*/
if (socket >= Instance->SE->GetMaxFds())
{
- User::QuitUser(Instance, New, "Server is full");
+ this->QuitUser(New, "Server is full");
return;
}
@@ -146,7 +146,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac
Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString());
if (*Instance->Config->MoronBanner)
New->WriteServ("NOTICE %s :*** %s", New->nick, Instance->Config->MoronBanner);
- User::QuitUser(Instance, New, b->Reason);
+ this->QuitUser(New, b->Reason);
return;
}
else
@@ -171,7 +171,7 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac
if (!Instance->SE->AddFd(New))
{
Instance->Logs->Log("USERS", DEBUG,"Internal error on new connection");
- User::QuitUser(Instance, New, "Internal error handling connection");
+ this->QuitUser(New, "Internal error handling connection");
}
/* NOTE: even if dns lookups are *off*, we still need to display this.
@@ -189,6 +189,22 @@ void UserManager::AddClient(InspIRCd* Instance, int socket, int port, bool iscac
}
}
+void UserManager::QuitUser(User *user, const std::string &quitreason, const char* operreason)
+{
+ ServerInstance->Logs->Log("USERS", DEBUG,"QuitUser: %s '%s'", user->nick, quitreason.c_str());
+ user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, *operreason ? operreason : quitreason.c_str());
+ user->quietquit = false;
+ user->quitmsg = quitreason;
+
+ if (!*operreason)
+ user->operquitmsg = quitreason;
+ else
+ user->operquitmsg = operreason;
+
+ ServerInstance->GlobalCulls.AddItem(user);
+}
+
+
void UserManager::AddLocalClone(User *user)
{
clonemap::iterator x = local_clones.find(user->GetIPString());