]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/usermanager.cpp
cgiirc: Pass hosts to WEBIRC command on rehash. No fucking wonder this never worked...
[user/henk/code/inspircd.git] / src / usermanager.cpp
index 521dcec417d18765f6943257f56f04e560c8aacf..da8061fba630e2e122357365f486251f01744202 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *         the file COPYING for details.
@@ -31,7 +31,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache
        catch (...)
        {
                Instance->Logs->Log("USERS", DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed.");
-               Instance->SNO->WriteToSnoMask('A', "WARNING *** Duplicate UUID allocated!");
+               Instance->SNO->WriteToSnoMask('a', "WARNING *** Duplicate UUID allocated!");
                return;
        }
 
@@ -106,7 +106,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache
 
        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);
+               Instance->SNO->WriteToSnoMask('a', "Warning: softlimit value has been reached: %d clients", Instance->Config->SoftLimit);
                this->QuitUser(New,"No more connections allowed");
                return;
        }
@@ -172,17 +172,47 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache
 
 void UserManager::QuitUser(User *user, const std::string &quitreason, const char* operreason)
 {
-       ServerInstance->Logs->Log("USERS", DEBUG,"QuitUser: %s '%s'", user->nick.c_str(), quitreason.c_str());
-       user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str());
+       if (user->quitting)
+       {
+               ServerInstance->Logs->Log("CULLLIST",DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick.c_str());
+               return;
+       }
+
+       user->quitting = true;
+
+       ServerInstance->Logs->Log("USERS", DEBUG, "QuitUser: %s '%s'", user->nick.c_str(), quitreason.c_str());
+       user->Write("ERROR :Closing link: (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str());
+
        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());
 }
 
 
@@ -268,7 +298,7 @@ void UserManager::RemoveCloneCounts(User *user)
                        local_clones.erase(x);
                }
        }
-       
+
        clonemap::iterator y = global_clones.find(user->GetCIDRMask(range));
        if (y != global_clones.end())
        {
@@ -480,6 +510,3 @@ int UserManager::ModeCount(const char mode)
        else
                return 0;
 }
-
-
-