From c0bc5bf7981e30229bdabfdf51a289635fe8be76 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 16 Apr 2022 11:48:08 +0100 Subject: Add ListModeBase::CanonicalizeParam, fix cleaning extban masks. --- include/modules/extban.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/modules') 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; } -- cgit v1.3.1-10-gc9f91