* ---------------------------------------------------
*/
-/* $Core */
-
#include "inspircd.h"
#include "xline.h"
#include "socketengine.h"
int InspIRCd::PassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
{
ModResult res;
- FIRST_MOD_RESULT(this, OnPassCompare, res, (ex, data, input, hashtype));
+ FIRST_MOD_RESULT(OnPassCompare, res, (ex, data, input, hashtype));
/* Module matched */
if (res == MOD_RES_ALLOW)
{
// If it *doesn't* exist, give it a slightly heftier penalty than normal to deter flooding us crap
user->IncreasePenalty(cm != cmdlist.end() ? cm->second->Penalty : 2);
- do_more = (user->Penalty < 10);
+ do_more = (user->GetClass()->GetPenaltyThreshold() && ((unsigned long)user->Penalty < user->GetClass()->GetPenaltyThreshold()));
}
if (cm == cmdlist.end())
{
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd));
+ FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd));
if (MOD_RESULT == MOD_RES_DENY)
return true;
* truncate to max_params if necessary. -- w00t
*/
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd));
+ FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, command_p, user, false, cmd));
if (MOD_RESULT == MOD_RES_DENY)
return true;
cm->second->total_bytes += cmd.length();
/* module calls too */
- FIRST_MOD_RESULT(ServerInstance, OnPreCommand, MOD_RESULT, (command, command_p, user, true, cmd));
+ FIRST_MOD_RESULT(OnPreCommand, MOD_RESULT, (command, command_p, user, true, cmd));
if (MOD_RESULT == MOD_RES_DENY)
return do_more;
}
}
-void CommandParser::RemoveCommands(Module* source)
+void CommandParser::RemoveCommand(Command* x)
{
- Commandtable::iterator i,safei;
- for (i = cmdlist.begin(); i != cmdlist.end();)
- {
- safei = i;
- i++;
- RemoveCommand(safei, source);
- }
+ Commandtable::iterator n = cmdlist.find(x->command);
+ if (n != cmdlist.end() && n->second == x)
+ cmdlist.erase(n);
}
-void CommandParser::RemoveCommand(Commandtable::iterator safei, Module* source)
+Command::~Command()
{
- Command* x = safei->second;
- if (x->creator == source)
- {
- cmdlist.erase(safei);
- }
+ ServerInstance->Parser->RemoveCommand(this);
}
bool CommandParser::ProcessBuffer(std::string &buffer,User *user)
return ProcessCommand(user,buffer);
}
-bool CommandParser::CreateCommand(Command *f)
+bool CommandParser::AddCommand(Command *f)
{
/* create the command and push it onto the table */
if (cmdlist.find(f->command) == cmdlist.end())
return false;
}
-CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance)
+CommandParser::CommandParser()
{
para.resize(128);
}