mirror of
https://github.com/anope/anope.git
synced 2026-07-07 16:03:15 +02:00
Merge branch '2.0' into 2.1.
This commit is contained in:
@@ -606,6 +606,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: matchers for the following extbans have not been implemented:
|
||||
//
|
||||
// * class(n): data not available
|
||||
// * country(G): data not available
|
||||
// * gateway(w): data not available in v3
|
||||
// * realmask(a): todo
|
||||
class InspIRCdExtBan
|
||||
: public ChannelModeVirtual<ChannelModeList>
|
||||
{
|
||||
@@ -646,7 +652,7 @@ namespace InspIRCdExtban
|
||||
bool Matches(User *u, const Entry *e) override
|
||||
{
|
||||
const Anope::string &mask = e->GetMask();
|
||||
Anope::string real_mask = mask.substr(3);
|
||||
Anope::string real_mask = mask.substr(2);
|
||||
|
||||
return Entry(this->name, real_mask).Matches(u);
|
||||
}
|
||||
@@ -664,7 +670,7 @@ namespace InspIRCdExtban
|
||||
{
|
||||
const Anope::string &mask = e->GetMask();
|
||||
|
||||
Anope::string channel = mask.substr(3);
|
||||
Anope::string channel = mask.substr(2);
|
||||
|
||||
ChannelMode *cm = NULL;
|
||||
if (channel[0] != '#')
|
||||
@@ -769,6 +775,26 @@ namespace InspIRCdExtban
|
||||
return !u->Account() && Entry("BAN", real_mask).Matches(u);
|
||||
}
|
||||
};
|
||||
|
||||
class OperTypeMatcher
|
||||
: public InspIRCdExtBan
|
||||
{
|
||||
public:
|
||||
OperTypeMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
|
||||
{
|
||||
}
|
||||
|
||||
bool Matches(User *u, const Entry *e) anope_override
|
||||
{
|
||||
Anope::string *opertype = u->GetExt<Anope::string>("opertype");
|
||||
if (!opertype)
|
||||
return false; // Not an operator.
|
||||
|
||||
const Anope::string &mask = e->GetMask();
|
||||
Anope::string real_mask = mask.substr(2);
|
||||
return Anope::Match(opertype->replace_all_cs(' ', '_'), real_mask);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class ColonDelimitedParamMode
|
||||
@@ -782,7 +808,7 @@ public:
|
||||
return IsValid(value, false);
|
||||
}
|
||||
|
||||
static bool IsValid(const Anope::string &value, bool historymode)
|
||||
static bool IsValid(const Anope::string &value, bool historymode)
|
||||
{
|
||||
if (value.empty())
|
||||
return false; // empty param is never valid
|
||||
@@ -1105,7 +1131,10 @@ struct IRCDMessageCapab final
|
||||
else if (mode.name.equals_cs("op"))
|
||||
cm = new ChannelModeStatus("OP", mode.letter, mode.symbol, mode.level);
|
||||
else if (mode.name.equals_cs("operonly"))
|
||||
{
|
||||
cm = new ChannelModeOperOnly("OPERONLY", mode.letter);
|
||||
ModeManager::AddChannelMode(new InspIRCdExtban::OperTypeMatcher("OPERTYPEBAN", "BAN", 'O'));
|
||||
}
|
||||
else if (mode.name.equals_cs("operprefix"))
|
||||
cm = new ChannelModeStatus("OPERPREFIX", mode.letter, mode.symbol, mode.level);
|
||||
else if (mode.name.equals_cs("permanent"))
|
||||
@@ -1825,7 +1854,14 @@ struct IRCDMessageNick final
|
||||
struct IRCDMessageOperType final
|
||||
: IRCDMessage
|
||||
{
|
||||
IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(FLAG_SOFT_LIMIT); SetFlag(FLAG_REQUIRE_USER); }
|
||||
PrimitiveExtensibleItem<Anope::string> opertype;
|
||||
|
||||
IRCDMessageOperType(Module *creator)
|
||||
: IRCDMessage(creator, "OPERTYPE", 1)
|
||||
, opertype(creator, "opertype")
|
||||
{
|
||||
SetFlag(FLAG_REQUIRE_USER);
|
||||
}
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override
|
||||
{
|
||||
@@ -1834,6 +1870,8 @@ struct IRCDMessageOperType final
|
||||
User *u = source.GetUser();
|
||||
if (!u->HasMode("OPER"))
|
||||
u->SetModesInternal(source, "+o");
|
||||
|
||||
opertype.Set(u, params[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user