]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/userprocess.cpp
Fix typos found by Zaba. Thanks.
[user/henk/code/inspircd.git] / src / userprocess.cpp
index dd6a4c24d697caa1f9914f820a315f8fd4673e49..52beeb0d57a39ca7a1872bedf4618c78a50c1350 100644 (file)
  * ---------------------------------------------------
  */
 
+#include "inspircd.h"
 #include "configreader.h"
 #include "users.h"
 #include "modules.h"
 #include "wildcard.h"
 #include "xline.h"
 #include "socketengine.h"
-#include "inspircd.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,29 +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);
-                               }
-
-                               return;
-                       }
-
-                       if (current->recvq.length() > (unsigned)this->Config->NetBufferSize)
-                       {
-                               if (current->registered == REG_ALL)
-                               {
-                                       current->SetWriteError("RecvQ exceeded");
-                               }
-                               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;
                        }
@@ -150,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;
                                }