From 63d71424650ac697f2e698c1c8fd242729691a0f Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 10 Jul 2010 22:50:18 -0400 Subject: Added options:hideprivilegedcommands config option to hide privileged commands from normal users --- src/core/bs_help.cpp | 3 ++- src/core/cs_help.cpp | 3 ++- src/core/hs_help.cpp | 3 ++- src/core/ms_help.cpp | 3 ++- src/core/ns_help.cpp | 3 ++- src/core/os_help.cpp | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/bs_help.cpp b/src/core/bs_help.cpp index 694318187..7183c6fe9 100644 --- a/src/core/bs_help.cpp +++ b/src/core/bs_help.cpp @@ -33,7 +33,8 @@ class CommandBSHelp : public Command // Abuse syntax error to display general list help. notice_help(Config.s_BotServ, u, BOT_HELP); for (CommandMap::const_iterator it = BotServ->Commands.begin(), it_end = BotServ->Commands.end(); it != it_end; ++it) - it->second->OnServHelp(u); + if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) + it->second->OnServHelp(u); notice_help(Config.s_BotServ, u, BOT_HELP_FOOTER, Config.BSMinUsers); } }; diff --git a/src/core/cs_help.cpp b/src/core/cs_help.cpp index f655752e6..536a6e423 100644 --- a/src/core/cs_help.cpp +++ b/src/core/cs_help.cpp @@ -50,7 +50,8 @@ class CommandCSHelp : public Command { notice_help(Config.s_ChanServ, u, CHAN_HELP); for (CommandMap::const_iterator it = ChanServ->Commands.begin(); it != ChanServ->Commands.end(); ++it) - it->second->OnServHelp(u); + if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) + it->second->OnServHelp(u); if (Config.CSExpire >= 86400) notice_help(Config.s_ChanServ, u, CHAN_HELP_EXPIRES, Config.CSExpire / 86400); if (u->Account() && u->Account()->IsServicesOper()) diff --git a/src/core/hs_help.cpp b/src/core/hs_help.cpp index 507f887ed..b4b20e149 100644 --- a/src/core/hs_help.cpp +++ b/src/core/hs_help.cpp @@ -31,7 +31,8 @@ class CommandHSHelp : public Command { notice_help(Config.s_HostServ, u, HOST_HELP, Config.s_HostServ); for (CommandMap::const_iterator it = HostServ->Commands.begin(), it_end = HostServ->Commands.end(); it != it_end; ++it) - it->second->OnServHelp(u); + if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) + it->second->OnServHelp(u); } }; diff --git a/src/core/ms_help.cpp b/src/core/ms_help.cpp index f2646904c..41cdaafb3 100644 --- a/src/core/ms_help.cpp +++ b/src/core/ms_help.cpp @@ -31,7 +31,8 @@ class CommandMSHelp : public Command { notice_help(Config.s_MemoServ, u, MEMO_HELP_HEADER); for (CommandMap::const_iterator it = MemoServ->Commands.begin(), it_end = MemoServ->Commands.end(); it != it_end; ++it) - it->second->OnServHelp(u); + if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) + it->second->OnServHelp(u); notice_help(Config.s_MemoServ, u, MEMO_HELP_FOOTER, Config.s_ChanServ); } }; diff --git a/src/core/ns_help.cpp b/src/core/ns_help.cpp index 423cc5c75..d23cbd208 100644 --- a/src/core/ns_help.cpp +++ b/src/core/ns_help.cpp @@ -42,7 +42,8 @@ class CommandNSHelp : public Command { notice_help(Config.s_NickServ, u, NICK_HELP); for (CommandMap::const_iterator it = NickServ->Commands.begin(), it_end = NickServ->Commands.end(); it != it_end; ++it) - it->second->OnServHelp(u); + if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) + it->second->OnServHelp(u); if (u->Account() && u->Account()->IsServicesOper()) notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP); if (Config.NSExpire >= 86400) diff --git a/src/core/os_help.cpp b/src/core/os_help.cpp index 9ddeda66e..d88119bd2 100644 --- a/src/core/os_help.cpp +++ b/src/core/os_help.cpp @@ -30,7 +30,8 @@ class CommandOSHelp : public Command { notice_help(Config.s_OperServ, u, OPER_HELP); for (CommandMap::const_iterator it = OperServ->Commands.begin(), it_end = OperServ->Commands.end(); it != it_end; ++it) - it->second->OnServHelp(u); + if (!Config.HidePrivilegedCommands || it->second->permission.empty() || (u->Account() && u->Account()->HasCommand(it->second->permission))) + it->second->OnServHelp(u); notice_help(Config.s_OperServ, u, OPER_HELP_LOGGED); } }; -- cgit