aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_hideoper.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-12-06 08:49:38 +0000
committerGravatar Sadie Powell2022-12-06 09:02:41 +0000
commit1452ed8e08da77a75ea330e549901b325fff22a2 (patch)
treec027cbc1728fc07c309d49f4609b3969fc9476b9 /src/modules/m_hideoper.cpp
parentLoad regex_pcre instead of regex_pcre2 for compat with v3. (diff)
downloadinspircd++-1452ed8e08da77a75ea330e549901b325fff22a2.tar.gz
inspircd++-1452ed8e08da77a75ea330e549901b325fff22a2.tar.bz2
inspircd++-1452ed8e08da77a75ea330e549901b325fff22a2.zip
If an oper is away then show it in `/STATS P`.
Also fix hideoper and the idle timestamp.
Diffstat (limited to 'src/modules/m_hideoper.cpp')
-rw-r--r--src/modules/m_hideoper.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index d0e45313b..192f0f998 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -148,24 +148,33 @@ public:
return MOD_RES_PASSTHRU;
size_t opers = 0;
+ bool source_has_priv = stats.GetSource()->HasPrivPermission("users/auspex");
for (const auto& oper : ServerInstance->Users.all_opers)
{
- if (oper->server->IsService())
+ if (oper->server->IsService() || (oper->IsModeSet(hm) && !source_has_priv))
continue;
opers++;
+ std::string extra;
+ if (oper->IsAway())
+ {
+ const std::string awayperiod = InspIRCd::DurationString(ServerInstance->Time() - oper->awaytime);
+ const std::string awaytime = InspIRCd::TimeString(oper->awaytime);
+ extra += InspIRCd::Format(": away for %s [since %s] (%s)", awayperiod.c_str(),
+ awaytime.c_str(), oper->awaymsg.c_str());
+ }
+
auto loper = IS_LOCAL(oper);
if (loper)
{
const std::string idleperiod = InspIRCd::DurationString(ServerInstance->Time() - loper->idle_lastmsg);
- const std::string idletime = InspIRCd::TimeString(ServerInstance->Time());
- stats.AddGenericRow(InspIRCd::Format("\x02%s\x02 (%s): idle for %s [since %s]", oper->nick.c_str(),
- oper->MakeHost().c_str(), idleperiod.c_str(), idletime.c_str()));
- }
- else
- {
- stats.AddGenericRow(InspIRCd::Format("\x02%s\x02 (%s)", oper->nick.c_str(), oper->MakeHost().c_str()));
+ const std::string idletime = InspIRCd::TimeString(loper->idle_lastmsg);
+ extra += InspIRCd::Format("%c idle for %s [since %s]", extra.empty() ? ':' : ',',
+ idleperiod.c_str(), idletime.c_str());
}
+
+ stats.AddGenericRow(InspIRCd::Format("\x02%s\x02 (%s)%s", oper->nick.c_str(),
+ oper->MakeHost().c_str(), extra.c_str()));
}
stats.AddGenericRow(InspIRCd::Format("%zu server operator%s total", opers, opers ? "s" : ""));
return MOD_RES_DENY;