mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Merge branch 'insp3' into master.
This commit is contained in:
commit
d0eae89821
@ -654,7 +654,7 @@ Changes the real name of the user to the specified real name.
|
||||
Changes the ident of the user to the specified ident.
|
||||
">
|
||||
|
||||
<helpop key="shun" title="/SHUN <nick!user@host> [<duration> :<reason>]" value="
|
||||
<helpop key="shun" title="/SHUN <nick!user@host>[,<nick!user@host>]+ [<duration> :<reason>]" value="
|
||||
Sets or removes a shun (global server-side ignore) on a nick!user@host mask.
|
||||
You must specify all three parameters to add a shun, and one parameter
|
||||
to remove a shun (just the nick!user@host).
|
||||
@ -727,7 +727,7 @@ Unloads a module from all linked servers.
|
||||
Unloads and reloads a module on all linked servers.
|
||||
">
|
||||
|
||||
<helpop key="kline" title="/KLINE <user@host> [<duration> :<reason>]" value="
|
||||
<helpop key="kline" title="/KLINE <user@host>[,<user@host>]+ [<duration> :<reason>]" value="
|
||||
Sets or removes a K-line (local user@host based ban) on a user@host mask.
|
||||
You must specify all three parameters to add a ban, and one parameter
|
||||
to remove a ban (just the user@host).
|
||||
@ -737,7 +737,7 @@ The duration may be specified in seconds, or in the format
|
||||
five minutes and six seconds. All fields in this format are optional.
|
||||
">
|
||||
|
||||
<helpop key="zline" title="/ZLINE <ipmask> [<duration> :<reason>]" value="
|
||||
<helpop key="zline" title="/ZLINE <ipmask>[,<ipmask>]+ [<duration> :<reason>]" value="
|
||||
Sets or removes a Z-line (global IP based ban) on an IP mask.
|
||||
You must specify all three parameters to add a ban, and one parameter
|
||||
to remove a ban (just the ipmask).
|
||||
@ -747,7 +747,7 @@ The duration may be specified in seconds, or in the format
|
||||
five minutes and six seconds. All fields in this format are optional.
|
||||
">
|
||||
|
||||
<helpop key="qline" title="/QLINE <nickmask> [<duration> :<reason>]" value="
|
||||
<helpop key="qline" title="/QLINE <nickmask>[,<nickmask>]+ [<duration> :<reason>]" value="
|
||||
Sets or removes a Q-line (global nick based ban) on a nick mask.
|
||||
You must specify all three parameters to add a ban, and one parameter
|
||||
to remove a ban (just the nickmask).
|
||||
@ -757,7 +757,7 @@ The duration may be specified in seconds, or in the format
|
||||
five minutes and six seconds. All fields in this format are optional.
|
||||
">
|
||||
|
||||
<helpop key="gline" title="/GLINE <user@host> [<duration> :<reason>]" value="
|
||||
<helpop key="gline" title="/GLINE <user@host>[,<user@host>]+ [<duration> :<reason>]" value="
|
||||
Sets or removes a G-line (global user@host based ban) on a user@host mask.
|
||||
You must specify all three parameters to add a ban, and one
|
||||
parameter to remove a ban (just the user@host).
|
||||
@ -767,7 +767,7 @@ The duration may be specified in seconds, or in the format
|
||||
five minutes and six seconds. All fields in this format are optional.
|
||||
">
|
||||
|
||||
<helpop key="eline" title="/ELINE <user@host> [<duration> :<reason>]" value="
|
||||
<helpop key="eline" title="/ELINE <user@host>[,<user@host>]+ [<duration> :<reason>]" value="
|
||||
Sets or removes a E-line (global user@host ban exception) on a user@host mask.
|
||||
You must specify at least 3 parameters to add an exception, and one
|
||||
parameter to remove an exception (just the user@host).
|
||||
|
@ -33,13 +33,15 @@ CommandEline::CommandEline(Module* parent)
|
||||
: Command(parent, "ELINE", 1, 3)
|
||||
{
|
||||
access_needed = CmdAccess::OPERATOR;
|
||||
syntax = { "<user@host> [<duration> :<reason>]" };
|
||||
syntax = { "<user@host>[,<user@host>]+ [<duration> :<reason>]" };
|
||||
}
|
||||
|
||||
CmdResult CommandEline::Handle(User* user, const Params& parameters)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||
return CmdResult::SUCCESS;
|
||||
|
||||
std::string target = parameters[0];
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
IdentHostPair ih;
|
||||
@ -60,7 +62,7 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters)
|
||||
}
|
||||
|
||||
InsaneBan::IPHostMatcher matcher;
|
||||
if (InsaneBan::MatchesEveryone(ih.first+"@"+ih.second, matcher, user, "E", "hostmasks"))
|
||||
if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'E', "hostmasks"))
|
||||
return CmdResult::FAILURE;
|
||||
|
||||
unsigned long duration;
|
||||
|
@ -34,13 +34,15 @@ CommandGline::CommandGline(Module* parent)
|
||||
: Command(parent, "GLINE", 1, 3)
|
||||
{
|
||||
access_needed = CmdAccess::OPERATOR;
|
||||
syntax = { "<user@host> [<duration> :<reason>]" };
|
||||
syntax = { "<user@host>[,<user@host>]+ [<duration> :<reason>]" };
|
||||
}
|
||||
|
||||
CmdResult CommandGline::Handle(User* user, const Params& parameters)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||
return CmdResult::SUCCESS;
|
||||
|
||||
std::string target = parameters[0];
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
IdentHostPair ih;
|
||||
@ -61,7 +63,7 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters)
|
||||
}
|
||||
|
||||
InsaneBan::IPHostMatcher matcher;
|
||||
if (InsaneBan::MatchesEveryone(ih.first+"@"+ih.second, matcher, user, "G", "hostmasks"))
|
||||
if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'G', "hostmasks"))
|
||||
return CmdResult::FAILURE;
|
||||
|
||||
else if (target.find('!') != std::string::npos)
|
||||
|
@ -34,13 +34,15 @@ CommandKline::CommandKline(Module* parent)
|
||||
: Command(parent, "KLINE", 1, 3)
|
||||
{
|
||||
access_needed = CmdAccess::OPERATOR;
|
||||
syntax = { "<user@host> [<duration> :<reason>]" };
|
||||
syntax = { "<user@host>[,<user@host>]+ [<duration> :<reason>]" };
|
||||
}
|
||||
|
||||
CmdResult CommandKline::Handle(User* user, const Params& parameters)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||
return CmdResult::SUCCESS;
|
||||
|
||||
std::string target = parameters[0];
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
IdentHostPair ih;
|
||||
@ -61,7 +63,7 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters)
|
||||
}
|
||||
|
||||
InsaneBan::IPHostMatcher matcher;
|
||||
if (InsaneBan::MatchesEveryone(ih.first+"@"+ih.second, matcher, user, "K", "hostmasks"))
|
||||
if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'K', "hostmasks"))
|
||||
return CmdResult::FAILURE;
|
||||
|
||||
if (target.find('!') != std::string::npos)
|
||||
|
@ -35,15 +35,18 @@ CommandQline::CommandQline(Module* parent)
|
||||
: Command(parent, "QLINE", 1, 3)
|
||||
{
|
||||
access_needed = CmdAccess::OPERATOR;
|
||||
syntax = { "<nickmask> [<duration> :<reason>]" };
|
||||
syntax = { "<nickmask>[,<nickmask>]+ [<duration> :<reason>]" };
|
||||
}
|
||||
|
||||
CmdResult CommandQline::Handle(User* user, const Params& parameters)
|
||||
{
|
||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||
return CmdResult::SUCCESS;
|
||||
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
NickMatcher matcher;
|
||||
if (InsaneBan::MatchesEveryone(parameters[0], matcher, user, "Q", "nickmasks"))
|
||||
if (InsaneBan::MatchesEveryone(parameters[0], matcher, user, 'Q', "nickmasks"))
|
||||
return CmdResult::FAILURE;
|
||||
|
||||
if (parameters[0].find('@') != std::string::npos || parameters[0].find('!') != std::string::npos || parameters[0].find('.') != std::string::npos)
|
||||
|
@ -35,13 +35,15 @@ CommandZline::CommandZline(Module* parent)
|
||||
: Command(parent, "ZLINE", 1, 3)
|
||||
{
|
||||
access_needed = CmdAccess::OPERATOR;
|
||||
syntax = { "<ipmask> [<duration> :<reason>]" };
|
||||
syntax = { "<ipmask>[,<ipmask>]+ [<duration> :<reason>]" };
|
||||
}
|
||||
|
||||
CmdResult CommandZline::Handle(User* user, const Params& parameters)
|
||||
{
|
||||
std::string target = parameters[0];
|
||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||
return CmdResult::SUCCESS;
|
||||
|
||||
std::string target = parameters[0];
|
||||
if (parameters.size() >= 3)
|
||||
{
|
||||
if (target.find('!') != std::string::npos)
|
||||
@ -66,7 +68,7 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters)
|
||||
}
|
||||
|
||||
IPMatcher matcher;
|
||||
if (InsaneBan::MatchesEveryone(ipaddr, matcher, user, "Z", "ipmasks"))
|
||||
if (InsaneBan::MatchesEveryone(ipaddr, matcher, user, 'Z', "ipmasks"))
|
||||
return CmdResult::FAILURE;
|
||||
|
||||
unsigned long duration;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "xline.h"
|
||||
#include "core_xline.h"
|
||||
|
||||
bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, const char* bantype, const char* confkey)
|
||||
bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, char bantype, const char* confkey)
|
||||
{
|
||||
auto insane = ServerInstance->Config->ConfValue("insane");
|
||||
|
||||
@ -42,7 +42,11 @@ bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User
|
||||
float percent = ((float)matches / (float)ServerInstance->Users.GetUsers().size()) * 100;
|
||||
if (percent > itrigger)
|
||||
{
|
||||
ServerInstance->SNO.WriteToSnoMask('a', "\002WARNING\002: %s tried to set a %s-line mask of %s, which covers %.2f%% of the network!", user->nick.c_str(), bantype, mask.c_str(), percent);
|
||||
const char* article = strchr("AEIOUaeiou", bantype) ? "an" : "a";
|
||||
ServerInstance->SNO.WriteToSnoMask('x', "\002WARNING\002: %s tried to set add %s %c-line on %s which covers %.2f%% of the network which is more than the maximum of %.2f%%!",
|
||||
user->nick.c_str(), article, bantype, mask.c_str(), percent, itrigger);
|
||||
user->WriteNotice(InspIRCd::Format("*** Unable to add %s %c-line on %s which covers %.2f%% of the network which is more than the maximum of %.2f%%!",
|
||||
article, bantype, mask.c_str(), percent, itrigger));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
* @param confkey Name of the config key (inside the insane tag) which if false disables any checking
|
||||
* @return True if the given mask matches too many users, false if not
|
||||
*/
|
||||
static bool MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, const char* bantype, const char* confkey);
|
||||
static bool MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, char bantype, const char* confkey);
|
||||
};
|
||||
|
||||
class CommandEline final
|
||||
|
@ -63,13 +63,15 @@ public:
|
||||
: Command(Creator, "SHUN", 1, 3)
|
||||
{
|
||||
access_needed = CmdAccess::OPERATOR;
|
||||
syntax = { "<nick!user@host> [<duration> :<reason>]" };
|
||||
syntax = { "<nick!user@host>[,<nick!user@host>]+ [<duration> :<reason>]" };
|
||||
}
|
||||
|
||||
CmdResult Handle(User* user, const Params& parameters) override
|
||||
{
|
||||
/* syntax: SHUN nick!user@host time :reason goes here */
|
||||
/* 'time' is a human-readable timestring, like 2d3h2s. */
|
||||
if (CommandParser::LoopCall(user, this, parameters, 0))
|
||||
return CmdResult::SUCCESS;
|
||||
|
||||
std::string target = parameters[0];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user