diff options
author | Adam <Adam@anope.org> | 2017-02-21 09:59:10 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-02-21 09:59:10 -0500 |
commit | 3f7c0829efb1d3af8f7a0e8092c6dadb2ed041e8 (patch) | |
tree | ed55e88e8dd51fdcf2fe2ffe3e7cfe8a70949853 | |
parent | 46d8af781d7d4b2d381ff43b13e0f3d176924271 (diff) |
os_forbid: match forbids exact on add/del
-rw-r--r-- | include/modules/os_forbid.h | 2 | ||||
-rw-r--r-- | modules/commands/os_forbid.cpp | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/modules/os_forbid.h b/include/modules/os_forbid.h index 0742ecd8d..9a43a7b02 100644 --- a/include/modules/os_forbid.h +++ b/include/modules/os_forbid.h @@ -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; }; diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 0d4426839..46d9aafb7 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -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) |