Allow differentiating non-oper helpers from opers.

This commit is contained in:
Sadie Powell 2023-02-27 21:53:58 +00:00
parent 2597dcd153
commit f72b30c9fa
2 changed files with 10 additions and 5 deletions

View File

@ -1070,8 +1070,10 @@
#<module name="helpmode"> #<module name="helpmode">
# #
# If you also use the hideoper module you can allow hidden opers with # If you also use the hideoper module you can allow hidden opers with
# the help mode set still to be included in `/STATS P`. # the help mode set to to be included in `/STATS P` and mark helpers
# <hideoper ignorehideoper="no"> # as such to differentiate them from opers.
# <hideoper ignorehideoper="no"
# markhelpers="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Hide chans module: Allows users to hide their channels list from non- # Hide chans module: Allows users to hide their channels list from non-

View File

@ -56,6 +56,7 @@ private:
bool ignorehideoper; bool ignorehideoper;
HelpOp helpop; HelpOp helpop;
UserModeReference hideoper; UserModeReference hideoper;
bool markhelpers;
public: public:
ModuleHelpMode() ModuleHelpMode()
@ -70,7 +71,8 @@ public:
void ReadConfig(ConfigStatus& status) override void ReadConfig(ConfigStatus& status) override
{ {
const auto& tag = ServerInstance->Config->ConfValue("helpmode"); const auto& tag = ServerInstance->Config->ConfValue("helpmode");
ignorehideoper = tag->getBool("ignorehideoper", false); ignorehideoper = tag->getBool("ignorehideoper");
markhelpers = tag->getBool("markhelpers", true);
} }
ModResult OnStats(Stats::Context& stats) override ModResult OnStats(Stats::Context& stats) override
@ -84,7 +86,7 @@ public:
continue; // Ignore services. continue; // Ignore services.
if (helper->IsOper() && (!ignorehideoper || !helper->IsModeSet(hideoper))) if (helper->IsOper() && (!ignorehideoper || !helper->IsModeSet(hideoper)))
continue; // Ignore helpers. continue; // Ignore opers.
std::string extra; std::string extra;
if (helper->IsAway()) if (helper->IsAway())
@ -104,7 +106,8 @@ public:
extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime); extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime);
} }
stats.AddGenericRow(INSP_FORMAT("\x02{}\x02 ({}){}", helper->nick, helper->GetRealUserHost(), extra)); stats.AddGenericRow(INSP_FORMAT("\x02{}\x02{} ({}){}", helper->nick, markhelpers ? " [helper]" : "",
helper->GetRealUserHost(), extra));
} }
// Allow the core to add normal opers. // Allow the core to add normal opers.