mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Allow user mode +h (helpop) to override +H (hideoper) in /STATS P.
Now we include +h users in the output inclusion doesn't inherently mean the user is an oper. Closes #1212.
This commit is contained in:
parent
d141f9c025
commit
0000a90d57
@ -1068,6 +1068,10 @@
|
||||
# Help mode module: Provides oper-only user mode `h` (helpop) which
|
||||
# marks a server operator as available for help.
|
||||
#<module name="helpmode">
|
||||
#
|
||||
# If you also use the hideoper module you can allow hidden opers with
|
||||
# the help mode set still to be included in `/STATS P`.
|
||||
# <hideoper ignorehideoper="no">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# Hide chans module: Allows users to hide their channels list from non-
|
||||
|
@ -53,17 +53,26 @@ class ModuleHelpMode final
|
||||
, public Whois::EventListener
|
||||
{
|
||||
private:
|
||||
bool ignorehideoper;
|
||||
HelpOp helpop;
|
||||
UserModeReference hideoper;
|
||||
|
||||
public:
|
||||
ModuleHelpMode()
|
||||
: Module(VF_VENDOR, "Adds user mode h (helpop) which marks a server operator as being available for help.")
|
||||
, Stats::EventListener(this)
|
||||
, Stats::EventListener(this, 50)
|
||||
, Whois::EventListener(this)
|
||||
, helpop(this)
|
||||
, hideoper(this, "hideoper")
|
||||
{
|
||||
}
|
||||
|
||||
void ReadConfig(ConfigStatus& status) override
|
||||
{
|
||||
const auto& tag = ServerInstance->Config->ConfValue("helpmode");
|
||||
ignorehideoper = tag->getBool("ignorehideoper", false);
|
||||
}
|
||||
|
||||
ModResult OnStats(Stats::Context& stats) override
|
||||
{
|
||||
if (stats.GetSymbol() != 'P')
|
||||
@ -71,8 +80,11 @@ public:
|
||||
|
||||
for (auto* oper : helpop.helpopers)
|
||||
{
|
||||
if (oper->IsOper() || oper->server->IsService())
|
||||
continue; // Ignore opers and services.
|
||||
if (oper->server->IsService())
|
||||
continue; // Ignore services.
|
||||
|
||||
if (oper->IsOper() && (!ignorehideoper || !oper->IsModeSet(hideoper)))
|
||||
continue; // Ignore opers.
|
||||
|
||||
std::string extra;
|
||||
if (oper->IsAway())
|
||||
|
Loading…
x
Reference in New Issue
Block a user