diff options
| author | 2022-04-16 11:48:08 +0100 | |
|---|---|---|
| committer | 2022-04-16 12:01:59 +0100 | |
| commit | c0bc5bf7981e30229bdabfdf51a289635fe8be76 (patch) | |
| tree | 9ccf09d595b797e4dcffe0c43c0ad7eb70260f39 /include/modules | |
| parent | Add a class that wraps a dynamic reference to the extban manager. (diff) | |
Add ListModeBase::CanonicalizeParam, fix cleaning extban masks.
Diffstat (limited to 'include/modules')
| -rw-r--r-- | include/modules/extban.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/modules/extban.h b/include/modules/extban.h index 17c66c031..b90829be9 100644 --- a/include/modules/extban.h +++ b/include/modules/extban.h @@ -73,6 +73,12 @@ public: */ virtual void AddExtBan(Base* extban) = 0; + /** Canonicalises a list mode entry if it is an extban. + * @param text The list mode entry to canonicalize. + * @return True if the text was a valid extban and was canonicalised. Otherwise, false. + */ + virtual bool Canonicalize(std::string& text) const = 0; + /** Unregisters an extban from the manager. * @param extban The extban instance to unregister. */ @@ -151,6 +157,11 @@ protected: } public: + /** Canonicalises a value for this extban. + * @param text The value to canonicalize. + */ + virtual void Canonicalize(std::string& text) { } + /** Retrieves the character used in bans to signify this extban. */ unsigned char GetLetter() const { return letter; } @@ -212,6 +223,13 @@ public: { } + /** @copydoc ExtBan::Base::Canonicalize */ + void Canonicalize(std::string& text) override + { + if (!GetManager() || !GetManager()->Canonicalize(text)) + ModeParser::CleanMask(text); + } + /** @copydoc ExtBan::Base::GetType */ Type GetType() const override { return ExtBan::Type::ACTING; } |
