* ---------------------------------------------------
*/
+/* $Core: libIRCDcommand_parse */
+
#include "inspircd.h"
#include "wildcard.h"
#include "xline.h"
void CommandParser::DoLines(User* current, bool one_only)
{
// while there are complete lines to process...
- int floodlines = 0;
+ unsigned int floodlines = 0;
while (current->BufferIsReady())
{
- if (ServerInstance->Time() > current->reset_due)
+ if (current->MyClass)
{
- current->reset_due = ServerInstance->Time() + current->threshold;
- current->lines_in = 0;
- }
+ if (ServerInstance->Time() > current->reset_due)
+ {
+ current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold();
+ current->lines_in = 0;
+ }
- if (++current->lines_in > current->flood && current->flood)
- {
- ServerInstance->FloodQuitUser(current);
- return;
- }
+ if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood())
+ {
+ ServerInstance->FloodQuitUser(current);
+ return;
+ }
- if ((++floodlines > current->flood) && (current->flood != 0))
- {
- ServerInstance->FloodQuitUser(current);
- return;
+ if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0))
+ {
+ ServerInstance->FloodQuitUser(current);
+ return;
+ }
}
// use GetBuffer to copy single lines into the sanitized string
return true;
}
- if (!user)
- {
- /*
- * before, we went and found the command even with no user.. seems nonsensical.
- * I'm not entirely sure when we would be passed NULL, but let's handle it
- * anyway, by dropping it like a hot potato. -- w00t
- */
- return true;
- }
-
/* find the command, check it exists */
Commandable::iterator cm = cmdlist.find(command);
}
/* Modify the user's penalty */
- user->Penalty += cm->second->Penalty;
- bool do_more = (user->Penalty < 10);
- if (do_more)
- user->OverPenalty = true;
+ bool do_more = true;
+ if (!user->ExemptFromPenalty)
+ {
+ user->IncreasePenalty(cm->second->Penalty);
+ do_more = (user->Penalty < 10);
+ if (!do_more)
+ user->OverPenalty = true;
+ }
/* activity resets the ping pending timer */
- user->nping = ServerInstance->Time() + user->pingmax;
+ if (user->MyClass)
+ user->nping = ServerInstance->Time() + user->MyClass->GetPingTime();
+
if (cm->second->flags_needed)
{
if (!user->IsModeSet(cm->second->flags_needed))
return false;
}
-CmdResult cmd_reload::Handle(const char** parameters, int pcnt, User *user)
+CmdResult cmd_reload::Handle(const char** parameters, int /* pcnt */, User *user)
{
user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick, parameters[0]);
if (ServerInstance->Parser->ReloadCommand(parameters[0], user))