diff options
Diffstat (limited to 'src/modules/m_helpmode.cpp')
| -rw-r--r-- | src/modules/m_helpmode.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/modules/m_helpmode.cpp b/src/modules/m_helpmode.cpp index 095e35ecc..7083aec48 100644 --- a/src/modules/m_helpmode.cpp +++ b/src/modules/m_helpmode.cpp @@ -57,6 +57,8 @@ private: HelpOp helpop; UserModeReference hideoper; bool markhelpers; + std::string helpchanmodes; + insp::flat_map<std::string, std::string> helpchans; public: ModuleHelpMode() @@ -70,6 +72,15 @@ public: void ReadConfig(ConfigStatus& status) override { + for (const auto& [_, tag] : ServerInstance->Config->ConfTags("helpchan")) + { + const auto name = tag->getString("name"); + if (name.empty()) + throw ModuleException(this, "<helpchan:name> must not be empty at " + tag->source.str()); + + helpchans[name] = tag->getString("prefix", "o", 1); + } + const auto& tag = ServerInstance->Config->ConfValue("helpmode"); ignorehideoper = tag->getBool("ignorehideoper"); markhelpers = tag->getBool("markhelpers", true); @@ -114,6 +125,22 @@ public: return MOD_RES_PASSTHRU; } + ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven, bool override) override + { + if (!user->IsModeSet(helpop)) + return MOD_RES_PASSTHRU; + + for (const auto& [helpchan, prefix] : helpchans) + { + if (InspIRCd::Match(cname, helpchan)) + { + privs.append(prefix); + break; + } + } + return MOD_RES_PASSTHRU; + } + void OnUserQuit(User* user, const std::string& message, const std::string& opermessage) override { if (user->IsModeSet(helpop)) |
