From e3fc46af3ea3999ea5eea7274f038f4f03357e0e Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 4 Sep 2014 13:08:22 +0200 Subject: [PATCH] Split ModeParser::DisplayListMode() into two parts ShowListModeList() sends the list of one listmode to a user, DisplayListMode() calls it for each mode letter --- include/mode.h | 7 +++++++ src/mode.cpp | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/mode.h b/include/mode.h index cbe20ff97..17d0ec64c 100644 --- a/include/mode.h +++ b/include/mode.h @@ -786,6 +786,13 @@ class CoreExport ModeParser : public fakederef * @return A map of mode handlers of the given type */ const ModeHandlerMap& GetModes(ModeType mt) const { return modehandlersbyname[mt]; } + + /** Show the list of a list mode to a user. Modules can deny the listing. + * @param user User to show the list to. + * @param chan Channel to show the list of. + * @param mh List mode to show the list of. + */ + void ShowListModeList(User* user, Channel* chan, ModeHandler* mh); }; inline const std::string& ModeParser::GetModeListFor004Numeric() diff --git a/src/mode.cpp b/src/mode.cpp index ce4cb5b87..5642e35b6 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -603,11 +603,19 @@ void ModeParser::DisplayListModes(User* user, Channel* chan, const std::string& if (!mh || !mh->IsListMode()) return; + ShowListModeList(user, chan, mh); + } +} + +void ModeParser::ShowListModeList(User* user, Channel* chan, ModeHandler* mh) +{ + { ModResult MOD_RESULT; FIRST_MOD_RESULT(OnRawMode, MOD_RESULT, (user, chan, mh, "", true)); if (MOD_RESULT == MOD_RES_DENY) - continue; + return; + unsigned char mletter = mh->GetModeChar(); bool display = true; if (!user->HasPrivPermission("channels/auspex") && ServerInstance->Config->HideModeLists[mletter] && (chan->GetPrefixValue(user) < HALFOP_VALUE)) { -- 2.39.5