summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-06-17 08:49:37 -0400
committerAdam <Adam@anope.org>2014-07-19 16:55:27 -0400
commitdcb5c0411b38f6fed7071ae1ebe1098abe6d0237 (patch)
treeee2cfb0cb5207b8605d14f2662dfe8cd0afbe542
parent107806bd1db9d6b1480b3a98e991611b4270f281 (diff)
m_hideoper: Hide hidden opers from /stats P. #874
-rw-r--r--src/modules/m_hideoper.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index fbab9685f..b83c7de1a 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -46,7 +46,7 @@ class ModuleHideOper : public Module
void init()
{
ServerInstance->Modules->AddService(hm);
- Implementation eventlist[] = { I_OnWhoisLine, I_OnSendWhoLine };
+ Implementation eventlist[] = { I_OnWhoisLine, I_OnSendWhoLine, I_OnStats };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
@@ -90,6 +90,27 @@ class ModuleHideOper : public Module
line.clear();
}
}
+
+ ModResult OnStats(char symbol, User* user, string_list &results)
+ {
+ if (symbol != 'P')
+ return MOD_RES_PASSTHRU;
+
+ unsigned int count = 0;
+ for (std::list<User*>::const_iterator i = ServerInstance->Users->all_opers.begin(); i != ServerInstance->Users->all_opers.end(); ++i)
+ {
+ User* oper = *i;
+ if (!ServerInstance->ULine(oper->server) && (IS_OPER(user) || !oper->IsModeSet('H')))
+ {
+ results.push_back(ServerInstance->Config->ServerName+" 249 " + user->nick + " :" + oper->nick + " (" + oper->ident + "@" + oper->dhost + ") Idle: " +
+ (IS_LOCAL(oper) ? ConvToStr(ServerInstance->Time() - oper->idle_lastmsg) + " secs" : "unavailable"));
+ count++;
+ }
+ }
+ results.push_back(ServerInstance->Config->ServerName+" 249 "+user->nick+" :"+ConvToStr(count)+" OPER(s)");
+
+ return MOD_RES_DENY;
+ }
};