CmdResult CommandMotd::Handle (const std::vector<std::string>& parameters, User *user)
{
if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
+ {
+ // Give extra penalty if a non-oper queries the /MOTD of a remote server
+ LocalUser* localuser = IS_LOCAL(user);
+ if ((localuser) && (!IS_OPER(user)))
+ localuser->CommandFloodPenalty += 2000;
return CMD_SUCCESS;
+ }
ConfigTag* tag = ServerInstance->Config->EmptyTag;
if (IS_LOCAL(user))
// Check to make sure they haven't registered -- Fix by FCS
if (user->registered == REG_ALL)
{
+ user->CommandFloodPenalty += 1000;
user->WriteNumeric(ERR_ALREADYREGISTERED, "%s :You may not reregister",user->nick.c_str());
return CMD_FAILURE;
}
public:
/** Constructor for ping.
*/
- CommandPing ( Module* parent) : Command(parent,"PING", 1, 2) { Penalty = 0; syntax = "<servername> [:<servername>]"; }
+ CommandPing ( Module* parent) : Command(parent,"PING", 1, 2) { syntax = "<servername> [:<servername>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
CmdResult CommandPong::Handle (const std::vector<std::string>&, User *user)
{
// set the user as alive so they survive to next ping
- if (IS_LOCAL(user))
- IS_LOCAL(user)->lastping = 1;
+ LocalUser* localuser = IS_LOCAL(user);
+ if (localuser)
+ {
+ // Increase penalty unless we've sent a PING and this is the reply
+ if (localuser->lastping)
+ localuser->CommandFloodPenalty += 1000;
+ else
+ localuser->lastping = 1;
+ }
return CMD_SUCCESS;
}
CmdResult CommandRules::Handle (const std::vector<std::string>& parameters, User *user)
{
if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
+ {
+ // Give extra penalty if a non-oper queries the /RULES of a remote server
+ LocalUser* localuser = IS_LOCAL(user);
+ if ((localuser) && (!IS_OPER(user)))
+ localuser->CommandFloodPenalty += 2000;
return CMD_SUCCESS;
+ }
ConfigTag* tag = ServerInstance->Config->EmptyTag;
if (IS_LOCAL(user))
CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
{
if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName)
+ {
+ // Give extra penalty if a non-oper does /STATS <remoteserver>
+ LocalUser* localuser = IS_LOCAL(user);
+ if ((localuser) && (!IS_OPER(user)))
+ localuser->CommandFloodPenalty += 2000;
return CMD_SUCCESS;
+ }
string_list values;
char search = parameters[0][0];
DoStats(search, user, values);
}
else
{
+ user->CommandFloodPenalty += 1000;
user->WriteNumeric(462, "%s :You may not reregister", user->nick.c_str());
return CMD_FAILURE;
}