diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_kill.cpp | 2 | ||||
-rw-r--r-- | src/commands/cmd_quit.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_blockamsg.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_close.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_waitpong.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_connflood.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_filter.h | 4 | ||||
-rw-r--r-- | src/modules/m_jumpserver.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_lockserv.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_nicklock.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_proxyscan.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_saquit.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/kill.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/svsnick.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 4 | ||||
-rw-r--r-- | src/usermanager.cpp | 26 | ||||
-rw-r--r-- | src/userprocess.cpp | 11 | ||||
-rw-r--r-- | src/users.cpp | 25 | ||||
-rw-r--r-- | src/xline.cpp | 4 |
20 files changed, 56 insertions, 53 deletions
diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 72aee4d1d..6932c8ed6 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -102,7 +102,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us } // send the quit out - User::QuitUser(ServerInstance, u, killreason); + ServerInstance->Users->QuitUser(u, killreason); } else { diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp index 29433ff5a..f7cbd00bf 100644 --- a/src/commands/cmd_quit.cpp +++ b/src/commands/cmd_quit.cpp @@ -38,7 +38,7 @@ CmdResult CommandQuit::Handle (const char* const* parameters, int pcnt, User *us else quitmsg = pcnt ? parameters[0] : "Client exited"; - User::QuitUser(ServerInstance, user, quitmsg); + ServerInstance->Users->QuitUser(user, quitmsg); return CMD_SUCCESS; } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 39d5b210f..e4a4eaf4e 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -140,7 +140,7 @@ class ModuleBlockAmsg : public Module ServerInstance->SNO->WriteToSnoMask('A', "%s had an /amsg or /ame denied", user->nick); if(action == IBLOCK_KILL || action == IBLOCK_KILLOPERS) - User::QuitUser(ServerInstance, user, "Global message (/amsg or /ame) detected"); + ServerInstance->Users->QuitUser(user, "Global message (/amsg or /ame) detected"); else if(action == IBLOCK_NOTICE || action == IBLOCK_NOTICEOPERS) user->WriteServ( "NOTICE %s :Global message (/amsg or /ame) detected", user->nick); diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 4d5c02d58..152ba3c59 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -32,7 +32,7 @@ class CommandClose : public Command { if ((*u)->registered != REG_ALL) { - User::QuitUser(ServerInstance, *u, "Closing all unknown connections per request"); + ServerInstance->Users->QuitUser(*u, "Closing all unknown connections per request"); std::string key = ConvToStr((*u)->GetIPString())+"."+ConvToStr((*u)->GetPort()); closed[key]++; } diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 4c27efec2..41900966c 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -87,7 +87,7 @@ class ModuleWaitPong : public Module else { if(killonbadreply) - User::QuitUser(ServerInstance, user, "Incorrect ping reply for registration"); + ServerInstance->Users->QuitUser(user, "Incorrect ping reply for registration"); return 1; } } diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 4800847e9..412a0965e 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -84,7 +84,8 @@ public: ServerInstance->SNO->WriteToSnoMask('A', "Connection throttle deactivated"); return 0; } - User::QuitUser(ServerInstance, user, quitmsg); + + ServerInstance->Users->QuitUser(user, quitmsg); return 1; } @@ -94,7 +95,7 @@ public: { throttled = 1; ServerInstance->SNO->WriteToSnoMask('A', "Connection throttle activated"); - User::QuitUser(ServerInstance, user, quitmsg); + ServerInstance->Users->QuitUser(user, quitmsg); return 1; } } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 6b11e7252..b68767933 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -108,7 +108,7 @@ class DNSBLResolver : public Resolver { case DNSBLConfEntry::I_KILL: { - User::QuitUser(ServerInstance, them, std::string("Killed (") + reason + ")"); + ServerInstance->Users->QuitUser(them, std::string("Killed (") + reason + ")"); break; } case DNSBLConfEntry::I_KLINE: diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index e1f97bd72..2ec56ea4f 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -276,7 +276,7 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri } if (f->action == "kill") { - User::QuitUser(ServerInstance,user,"Filtered: "+f->reason); + ServerInstance->Users->QuitUser(user, "Filtered: " + f->reason); } if (f->action == "gline") { @@ -364,7 +364,7 @@ int FilterBase::OnPreCommand(const std::string &command, const char* const* para if ((parting) && (f->action == "kill")) { user->WriteServ("NOTICE %s :*** Your PART message was filtered: %s", user->nick, f->reason.c_str()); - User::QuitUser(ServerInstance, user, "Filtered: " + f->reason); + ServerInstance->Users->QuitUser(user, "Filtered: " + f->reason); } if (f->action == "gline") { diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index d0c692d0c..5593b482a 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -90,7 +90,7 @@ class CommandJumpserver : public Command if (!IS_OPER(t)) { t->WriteNumeric(10, "%s %s %s :Please use this Server/Port instead", user->nick, parameters[0], parameters[1]); - User::QuitUser(ServerInstance, t, reason); + ServerInstance->Users->QuitUser(t, reason); n_done++; } } @@ -142,7 +142,7 @@ class ModuleJumpServer : public Module if (js->port && js->redirect_new_users) { user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", user->nick, js->redirect_to.c_str(), js->port); - User::QuitUser(ServerInstance, user, js->reason); + ServerInstance->Users->QuitUser(user, js->reason); return 0; } return 0; diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 9c9baa522..f1d6e764f 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -106,7 +106,7 @@ public: { if (locked) { - User::QuitUser(ServerInstance, user, "Server is temporarily closed. Please try again later."); + ServerInstance->Users->QuitUser(user, "Server is temporarily closed. Please try again later."); return 1; } return 0; diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 090481d06..8fae46279 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -58,8 +58,8 @@ class CommandNicklock : public Command if (!target->ForceNickChange(parameters[1])) { - // ugh, nickchange failed for some reason -- possibly existing nick? - User::QuitUser(ServerInstance, target, "Nickname collision"); + // ugh, nickchange failed for some reason -- possibly existing nick? XXX change to UID here + ServerInstance->Users->QuitUser(target, "Nickname collision"); } // give them a lock flag diff --git a/src/modules/m_proxyscan.cpp b/src/modules/m_proxyscan.cpp index f0882b53e..ba6f17daa 100644 --- a/src/modules/m_proxyscan.cpp +++ b/src/modules/m_proxyscan.cpp @@ -289,7 +289,7 @@ class ProxySocket : public EventHandler if (match == true) { - User::QuitUser(ServerInstance, this->user, "Open proxy detected."); + ServerInstance->Users->QuitUser(this->user, "Open proxy detected."); } /* Close (but dont delete from memory) our socket diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 704ae4c14..17ccd713d 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -46,7 +46,7 @@ class CommandSaquit : public Command if (!IS_LOCAL(dest)) return CMD_SUCCESS; - User::QuitUser(ServerInstance, dest, line); + ServerInstance->Users->QuitUser(dest, line); return CMD_SUCCESS; } else diff --git a/src/modules/m_spanningtree/kill.cpp b/src/modules/m_spanningtree/kill.cpp index 5e7739c62..ca68867e6 100644 --- a/src/modules/m_spanningtree/kill.cpp +++ b/src/modules/m_spanningtree/kill.cpp @@ -43,7 +43,7 @@ bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> & // NOTE: This is safe with kill hiding on, as RemoteKill is only reached if we have a server prefix. // in short this is not executed for USERS. who->Write(":%s KILL %s :%s (%s)", prefix.c_str(), who->nick, prefix.c_str(), reason.c_str()); - User::QuitUser(this->Instance,who,reason); + this->Instance->Users->QuitUser(who, reason); } return true; } diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp index 82bcd1ff0..adf8f012e 100644 --- a/src/modules/m_spanningtree/svsnick.cpp +++ b/src/modules/m_spanningtree/svsnick.cpp @@ -54,7 +54,7 @@ bool TreeSocket::ForceNick(const std::string &prefix, std::deque<std::string> &p /* buh. UID them */ if (!u->ForceNickChange(u->uuid)) { - User::QuitUser(this->Instance, u, "Nickname collision"); + this->Instance->Users->QuitUser(u, "Nickname collision"); return true; } } diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 43825cc74..0b21a462d 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -186,9 +186,9 @@ int TreeServer::QuitUsers(const std::string &reason) if (!IS_LOCAL(a)) { if (ServerInstance->Config->HideSplits) - User::QuitUser(ServerInstance, a, "*.net *.split", reason_s); + ServerInstance->Users->QuitUser(a, "*.net *.split", reason_s); else - User::QuitUser(ServerInstance, a, reason_s); + ServerInstance->Users->QuitUser(a, reason_s); if (this->Utils->quiet_bursts) ServerInstance->GlobalCulls.MakeSilent(a); 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()); diff --git a/src/userprocess.cpp b/src/userprocess.cpp index c2de4dc2b..286135f22 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -25,7 +25,7 @@ void FloodQuitUserHandler::Call(User* current) Server->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s", current->registered == REG_ALL ? current->nick : "", current->registered == REG_ALL ? "!" : "", current->ident, current->host); - User::QuitUser(Server, current, "Excess flood"); + Server->Users->QuitUser(current, "Excess flood"); if (current->registered != REG_ALL) { @@ -140,7 +140,7 @@ void ProcessUserHandler::Call(User* cu) if ((result == -1) && (errno != EAGAIN) && (errno != EINTR)) { - User::QuitUser(Server, cu, errno ? strerror(errno) : "EOF from client"); + Server->Users->QuitUser(cu, errno ? strerror(errno) : "EOF from client"); return; } } @@ -152,7 +152,7 @@ void ProcessUserHandler::Call(User* cu) } else if (result == 0) { - User::QuitUser(Server, cu, "Connection closed"); + Server->Users->QuitUser(cu, "Connection closed"); return; } } @@ -190,7 +190,7 @@ void InspIRCd::DoBackgroundUserStuff() * registration timeout -- didnt send USER/NICK/HOST * in the time specified in their connection class. */ - User::QuitUser(this, curr, "Registration timeout"); + this->Users->QuitUser(curr, "Registration timeout"); continue; } @@ -221,9 +221,10 @@ void InspIRCd::DoBackgroundUserStuff() snprintf(message, MAXBUF, "Ping timeout: %ld second%s", (long)time, time > 1 ? "s" : ""); curr->lastping = 1; curr->nping = TIME + curr->MyClass->GetPingTime(); - User::QuitUser(this, curr, message); + this->Users->QuitUser(curr, message); continue; } + curr->Write("PING :%s",this->Config->ServerName); curr->lastping = 0; curr->nping = TIME +curr->MyClass->GetPingTime(); diff --git a/src/users.cpp b/src/users.cpp index 387658ac6..43bf64f1c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -817,21 +817,6 @@ void User::UnOper() } } -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() { @@ -853,18 +838,18 @@ void User::CheckClass() 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; } @@ -892,7 +877,7 @@ void User::FullConnect() */ if (this->MyClass && !this->MyClass->GetPass().empty() && !this->haspassed) { - User::QuitUser(ServerInstance, this, "Invalid password"); + ServerInstance->Users->QuitUser(this, "Invalid password"); return; } @@ -1848,7 +1833,7 @@ void User::HandleEvent(EventType et, int errornum) { if (!WriteError.empty()) { - User::QuitUser(ServerInstance, this, GetWriteError()); + ServerInstance->Users->QuitUser(this, GetWriteError()); } } } diff --git a/src/xline.cpp b/src/xline.cpp index c964ec962..47e122420 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -409,9 +409,9 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) if (*ServerInstance->Config->MoronBanner) u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) - User::QuitUser(ServerInstance, u, line + "-Lined", sreason); + ServerInstance->Users->QuitUser(u, line + "-Lined", sreason); else - User::QuitUser(ServerInstance, u, sreason); + ServerInstance->Users->QuitUser(u, sreason); if (bancache) |