1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 12:53:14 +02:00

os_forbid: match forbids exact on add/del

This commit is contained in:
Adam
2017-02-21 09:59:10 -05:00
parent 46d8af781d
commit 3f7c0829ef
2 changed files with 16 additions and 2 deletions
+2
View File
@@ -45,6 +45,8 @@ class ForbidService : public Service
virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) = 0;
virtual ForbidData *FindForbidExact(const Anope::string &mask, ForbidType type) = 0;
virtual std::vector<ForbidData *> GetForbids() = 0;
};
+14 -2
View File
@@ -105,6 +105,18 @@ class MyForbidService : public ForbidService
return NULL;
}
ForbidData *FindForbidExact(const Anope::string &mask, ForbidType ftype) anope_override
{
for (unsigned i = this->forbids(ftype).size(); i > 0; --i)
{
ForbidData *d = this->forbids(ftype)[i - 1];
if (d->mask.equals_ci(mask))
return d;
}
return NULL;
}
std::vector<ForbidData *> GetForbids() anope_override
{
std::vector<ForbidData *> f;
@@ -203,7 +215,7 @@ class CommandOSForbid : public Command
return;
}
ForbidData *d = this->fs->FindForbid(entry, ftype);
ForbidData *d = this->fs->FindForbidExact(entry, ftype);
bool created = false;
if (d == NULL)
{
@@ -322,7 +334,7 @@ class CommandOSForbid : public Command
{
const Anope::string &entry = params[2];
ForbidData *d = this->fs->FindForbid(entry, ftype);
ForbidData *d = this->fs->FindForbidExact(entry, ftype);
if (d != NULL)
{
if (Anope::ReadOnly)