}
}
-void User::QuitUser(InspIRCd* Instance, User *user, const std::string &quitreason, const char* operreason)
-{
- Instance->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;
-
- Instance->GlobalCulls.AddItem(user);
-}
-
/* adds or updates an entry in the whowas list */
void User::AddToWhoWas()
{
if ((!a) || (a->GetType() == CC_DENY))
{
- User::QuitUser(ServerInstance, this, "Unauthorised connection");
+ ServerInstance->Users->QuitUser(this, "Unauthorised connection");
return;
}
else if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal()))
{
- User::QuitUser(ServerInstance, this, "No more connections allowed from your host via this connect class (local)");
+ ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)");
ServerInstance->SNO->WriteToSnoMask('A', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString());
return;
}
else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal()))
{
- User::QuitUser(ServerInstance, this, "No more connections allowed from your host via this connect class (global)");
+ ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)");
ServerInstance->SNO->WriteToSnoMask('A', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString());
return;
}
*/
if (this->MyClass && !this->MyClass->GetPass().empty() && !this->haspassed)
{
- User::QuitUser(ServerInstance, this, "Invalid password");
+ ServerInstance->Users->QuitUser(this, "Invalid password");
return;
}
bool User::ForceNickChange(const char* newnick)
{
- /*
- * XXX this makes no sense..
- * why do we do nothing for change on users not REG_ALL?
- * why do we trigger events twice for everyone previously (and just them now)
- * i think the first if () needs removing totally, or? -- w00t
- */
- if (this->registered != REG_ALL)
- {
- int MOD_RESULT = 0;
-
- this->InvalidateCache();
+ int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
+ this->InvalidateCache();
- if (MOD_RESULT)
- {
- ServerInstance->stats->statsCollisions++;
- return false;
- }
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
- if (ServerInstance->XLines->MatchesLine("Q",newnick))
- {
- ServerInstance->stats->statsCollisions++;
- return false;
- }
+ if (MOD_RESULT)
+ {
+ ServerInstance->stats->statsCollisions++;
+ return false;
}
- else
+
+ std::deque<classbase*> dummy;
+ Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
+ if (nickhandler) // wtfbbq, when would this not be here
{
- std::deque<classbase*> dummy;
- Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
- if (nickhandler) // wtfbbq, when would this not be here
- {
- nickhandler->HandleInternal(1, dummy);
- bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
- nickhandler->HandleInternal(0, dummy);
- return result;
- }
+ nickhandler->HandleInternal(1, dummy);
+ bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
+ nickhandler->HandleInternal(0, dummy);
+ return result;
}
- // Unreachable.
+ // Unreachable, we hope
return false;
}
{
if (!WriteError.empty())
{
- User::QuitUser(ServerInstance, this, GetWriteError());
+ ServerInstance->Users->QuitUser(this, GetWriteError());
}
}
}