summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands/cmd_modules.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index c37008563..fe199e7a4 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -49,8 +49,24 @@ class CommandModules : public Command
/** Handle /MODULES
*/
-CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
+CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, User *user)
{
+ // Don't ask remote servers about their modules unless the local user asking is an oper
+ // 2.0 asks anyway, so let's handle that the same way
+ bool for_us = (parameters.empty() || parameters[0] == ServerInstance->Config->ServerName);
+ if ((!for_us) || (!IS_LOCAL(user)))
+ {
+ if (!user->IsOper())
+ {
+ user->WriteNotice("*** You cannot check what modules other servers have loaded.");
+ return CMD_FAILURE;
+ }
+
+ // From an oper and not for us, forward
+ if (!for_us)
+ return CMD_SUCCESS;
+ }
+
const ModuleManager::ModuleMap& mods = ServerInstance->Modules->GetModules();
for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)