- // while there are complete lines to process...
- while (current->BufferIsReady())
- {
- if (TIME > current->reset_due)
- {
- current->reset_due = TIME + current->threshold;
- current->lines_in = 0;
- }
-
- if (++current->lines_in > current->flood)
- {
- this->Log(DEFAULT,"Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
- WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
- userrec::QuitUser(this, current,"Excess flood");
- 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);
- WriteOpers("*** Excess flood from: %s!%s@%s",current->nick,current->ident,current->host);
- userrec::QuitUser(this, current,"Excess flood");
- }
- else
- {
- XLines->add_zline(120,this->Config->ServerName,"Flood from unregistered connection",current->GetIPString());
- XLines->apply_lines(APPLY_ZLINES);
- }
-
- return;
- }
-
- // use GetBuffer to copy single lines into the sanitized string
- std::string single_line = current->GetBuffer();
- current->bytes_in += single_line.length();
- current->cmds_in++;
- if (single_line.length() > 512)
- single_line.resize(512);
-
- EventHandler* old_comp = this->SE->GetRef(currfd);
-
- this->Parser->ProcessBuffer(single_line,current);
- /*
- * look for the user's record in case it's changed... if theyve quit,
- * we cant do anything more with their buffer, so bail.
- * there used to be an ugly, slow loop here. Now we have a reference
- * table, life is much easier (and FASTER)
- */
- EventHandler* new_comp = this->SE->GetRef(currfd);
- if (old_comp != new_comp)
- {
- return;
- }
- else
- {
- /* The user is still here, flush their buffer */
- current->FlushWriteBuf();
- }
- }