diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-04 17:31:31 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-04 17:31:31 +0000 |
commit | 75f82deb8706d6fb23f19e2af8301bfe7c9b7693 (patch) | |
tree | 2397dd2651132c72c1ca861a724d2833099c3e53 /src | |
parent | 01a726e7a311cb45b18dcdc42875166e9e52ca21 (diff) |
Excess flood tidyups
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7230 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/userprocess.cpp | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 3a85be62a..52beeb0d5 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -20,6 +20,20 @@ #include "socketengine.h" #include "command_parse.h" +void InspIRCd::FloodQuitUser(userrec* current) +{ + this->Log(DEFAULT,"Excess flood from: %s@%s", current->ident, current->host); + this->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s", + current->registered == REG_ALL ? current->nick : "", + current->registered == REG_ALL ? "!" : "", current->ident, current->host); + current->SetWriteError("Excess flood"); + if (current->registered != REG_ALL) + { + XLines->add_zline(120,this->Config->ServerName,"Flood from unregistered connection",current->GetIPString()); + XLines->apply_lines(APPLY_ZLINES); + } +} + void InspIRCd::ProcessUser(userrec* cu) { int result = EAGAIN; @@ -99,12 +113,7 @@ void InspIRCd::ProcessUser(userrec* cu) current->lines_in++; if (current->lines_in > current->flood) - { - this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); - this->SNO->WriteToSnoMask('f',"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); - current->SetWriteError("Excess flood"); - return; - } + FloodQuitUser(current); else { current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick, MAXBUF-2); @@ -112,12 +121,7 @@ void InspIRCd::ProcessUser(userrec* cu) } } else - { - this->WriteOpers("*** Excess flood from %s",current->GetIPString()); - this->SNO->WriteToSnoMask('f',"Excess flood from: %s",current->GetIPString()); - XLines->add_zline(120,this->Config->ServerName,"Flood from unregistered connection",current->GetIPString()); - XLines->apply_lines(APPLY_ZLINES); - } + FloodQuitUser(current); return; } @@ -133,26 +137,13 @@ void InspIRCd::ProcessUser(userrec* cu) if (++current->lines_in > current->flood) { - this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); - this->SNO->WriteToSnoMask('f',"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); - current->SetWriteError("Excess flood"); + FloodQuitUser(current); return; } if ((++floodlines > current->flood) && (current->flood != 0)) { - if (current->registered == REG_ALL) - { - this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); - SNO->WriteToSnoMask('f',"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host); - current->SetWriteError("Excess flood"); - } - else - { - XLines->add_zline(120,this->Config->ServerName,"Flood from unregistered connection",current->GetIPString()); - XLines->apply_lines(APPLY_ZLINES); - } - + FloodQuitUser(current); return; } |