1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 17:24:49 +02:00

Remove hard coded references to default access levels.

This commit is contained in:
Sadie Powell
2026-05-21 11:43:30 +01:00
parent 6d2c4fb612
commit 59c60849b6
10 changed files with 89 additions and 35 deletions
+7
View File
@@ -92,6 +92,13 @@ public:
{
return new AccessChanAccess(this);
}
void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) override
{
auto it = defaultLevels.find(p->name);
if (it != defaultLevels.end())
access[_("Level")] = LevelToString(source, it->second);
}
};
AccessAccessProvider *AccessAccessProvider::me;
+5 -4
View File
@@ -272,11 +272,12 @@ public:
source.Reply(_(
"Bans a given nick or mask on a channel. An optional expiry may "
"be given to cause services to remove the ban after a set amount "
"of time."
"\n\n"
"By default, limited to AOPs or those with level 5 access "
"and above on the channel. Channel founders may ban masks."
"of time. Channel founders may ban masks."
));
source.Reply(" ");
AccessProvider::SendAccess(source, "BAN");
return true;
}
};
+7
View File
@@ -84,6 +84,13 @@ public:
{
return new FlagsChanAccess(this);
}
void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) override
{
auto it = defaultFlags.find(p->name);
if (it != defaultFlags.end())
access[_("Flag")] = Anope::ToString(it->second);
}
};
FlagsAccessProvider *FlagsAccessProvider::ap;
+4 -3
View File
@@ -95,11 +95,12 @@ public:
source.Reply(_(
"Tells %s to invite you or an optionally specified "
"nick into the given channel."
"\n\n"
"By default, limited to AOPs or those with level 5 access and above "
"on the channel."
),
source.service->nick.c_str());
source.Reply(" ");
AccessProvider::SendAccess(source, "INVITE");
return true;
}
};
+5 -6
View File
@@ -134,12 +134,11 @@ public:
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_(
"Kicks a specified nick from a channel."
"\n\n"
"By default, limited to AOPs or those with level 5 access "
"and above on the channel. Channel founders can also specify masks."
));
source.Reply(_("Kicks a specified nick from a channel. Channel founders can also specify masks."));
source.Reply(" ");
AccessProvider::SendAccess(source, "KICK");
return true;
}
};
+4 -3
View File
@@ -128,11 +128,12 @@ public:
"user from entering the given channel. If no channel is "
"given, all bans affecting you in channels you have access "
"in are removed."
"\n\n"
"By default, limited to AOPs or those with level 5 access and above "
"on the channel."
),
source.service->nick.c_str());
source.Reply(" ");
AccessProvider::SendAccess(source, "UNBAN");
return true;
}
};
+13
View File
@@ -100,6 +100,19 @@ public:
{
return new XOPChanAccess(this);
}
void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) override
{
for (const auto& xop : order)
{
const auto &privs = permissions[xop];
if (std::find(privs.begin(), privs.end(), p->name) != privs.end())
{
access[_("XOP")] = xop;
return;
}
}
}
};
class CommandCSXOP final