summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-02-29 16:32:14 +0000
committerSadie Powell <sadie@witchery.services>2024-02-29 16:32:14 +0000
commit54410932111d8d07d0a7afd912953f84eadf12e7 (patch)
treed4429850e696099021e506ae6581291d22ebcd86
parent579af3c44200a8325bd2eec9e6ff0ec28fa7125b (diff)
parentee7455daa8d80aff7ce41842e218d73a114f7bf2 (diff)
Merge branch '2.0' into 2.1.
-rw-r--r--modules/protocol/inspircd.cpp46
-rw-r--r--modules/webcpanel/pages/chanserv/set.cpp2
2 files changed, 43 insertions, 5 deletions
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index efefc4ab3..275f963a6 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -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> &params, 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]);
}
};
diff --git a/modules/webcpanel/pages/chanserv/set.cpp b/modules/webcpanel/pages/chanserv/set.cpp
index 151f0b0ea..65f79700b 100644
--- a/modules/webcpanel/pages/chanserv/set.cpp
+++ b/modules/webcpanel/pages/chanserv/set.cpp
@@ -50,7 +50,7 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
ci->Extend<bool>("KEEPTOPIC");
else
ci->Shrink<bool>("KEEPTOPIC");
- replacements["MESSAGES"] = "Secure updated";
+ replacements["MESSAGES"] = "Keeptopic updated";
}
if (ci->HasExt("PEACE") != message.post_data.count("peace"))
{