diff options
| author | 2025-03-08 17:32:23 +0000 | |
|---|---|---|
| committer | 2025-03-10 19:18:24 +0000 | |
| commit | ad85c6cb42c007e3a13d6ada08a52487e855ed28 (patch) | |
| tree | 088bb6f22648eb16dffdbed2cf4c3f66239f68d1 /src/modules/m_helpmode.cpp | |
| parent | Improve the clock jumping message slightly. (diff) | |
| download | inspircd++-ad85c6cb42c007e3a13d6ada08a52487e855ed28.tar.gz inspircd++-ad85c6cb42c007e3a13d6ada08a52487e855ed28.tar.bz2 inspircd++-ad85c6cb42c007e3a13d6ada08a52487e855ed28.zip | |
Add <helpchan> for granting privs to helpers on join.
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)) |
