1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
18 #include "socketengine.h"
19 #include "command_parse.h"
21 void FloodQuitUserHandler::Call(User* current)
23 ServerInstance->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident.c_str(), current->host.c_str());
24 ServerInstance->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s",
25 current->registered == REG_ALL ? current->nick.c_str() : "",
26 current->registered == REG_ALL ? "!" : "", current->ident.c_str(), current->host.c_str());
27 ServerInstance->Users->QuitUser(current, "Excess flood");
29 if (current->registered != REG_ALL)
31 ZLine* zl = new ZLine(ServerInstance->Time(), 0, ServerInstance->Config->ServerName, "Flood from unregistered connection", current->GetIPString());
32 if (ServerInstance->XLines->AddLine(zl,NULL))
33 ServerInstance->XLines->ApplyLines();
40 * This function is called once a second from the mainloop.
41 * It is intended to do background checking on all the user structs, e.g.
42 * stuff like ping checks, registration timeouts, etc.
44 void InspIRCd::DoBackgroundUserStuff()
47 * loop over all local users..
49 std::vector<User*>::reverse_iterator count2 = this->Users->local_users.rbegin();
50 while (count2 != this->Users->local_users.rend())
64 switch (curr->registered)
67 if (TIME > curr->nping)
69 // This user didn't answer the last ping, remove them
72 time_t time = this->Time() - (curr->nping - curr->MyClass->GetPingTime());
74 snprintf(message, MAXBUF, "Ping timeout: %ld second%s", (long)time, time > 1 ? "s" : "");
76 curr->nping = TIME + curr->MyClass->GetPingTime();
77 this->Users->QuitUser(curr, message);
81 curr->Write("PING :%s",this->Config->ServerName.c_str());
83 curr->nping = TIME +curr->MyClass->GetPingTime();
87 if (AllModulesReportReady(curr) && curr->dns_done)
89 /* User has sent NICK/USER, modules are okay, DNS finished. */
96 if (curr->registered != REG_ALL && (TIME > (curr->age + curr->MyClass->GetRegTimeout())))
99 * registration timeout -- didnt send USER/NICK/HOST
100 * in the time specified in their connection class.
102 this->Users->QuitUser(curr, "Registration timeout");