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. --- src/listmode.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/listmode.cpp') diff --git a/src/listmode.cpp b/src/listmode.cpp index 48fe52b80..e224f1168 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -22,11 +22,10 @@ #include "inspircd.h" #include "listmode.h" -ListModeBase::ListModeBase(Module* Creator, const std::string& Name, char modechar, unsigned int lnum, unsigned int eolnum, bool autotidy) +ListModeBase::ListModeBase(Module* Creator, const std::string& Name, char modechar, unsigned int lnum, unsigned int eolnum) : ModeHandler(Creator, Name, modechar, PARAM_ALWAYS, MODETYPE_CHANNEL, MC_LIST) , listnumeric(lnum) , endoflistnumeric(eolnum) - , tidy(autotidy) , extItem(Creator, "list-mode-" + name, ExtensionType::CHANNEL) { list = true; @@ -156,8 +155,10 @@ ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, Mod if (change.adding) { - if (tidy) - ModeParser::CleanMask(change.param); + // Try to canonicalise the parameter locally. + LocalUser* lsource = IS_LOCAL(source); + if (lsource && !CanonicalizeParam(lsource, channel, change.param)) + return MODEACTION_DENY; // If there was no list if (!cd) @@ -230,6 +231,11 @@ ModeAction ListModeBase::OnModeChange(User* source, User*, Channel* channel, Mod } } +bool ListModeBase::CanonicalizeParam(LocalUser* user, Channel* channel, std::string& parameter) +{ + return true; +} + bool ListModeBase::ValidateParam(User* user, Channel* channel, const std::string& parameter) { return true; -- cgit v1.3.1-10-gc9f91