summaryrefslogtreecommitdiff
path: root/src/commands/cmd_modules.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/cmd_modules.cpp')
-rw-r--r--src/commands/cmd_modules.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 2a15b43ed..d9fa7d5d5 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -56,14 +56,27 @@ class CommandModules : public Command
*/
CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (parameters.size() >= 1 && parameters[0] != ServerInstance->Config->ServerName)
- return CMD_SUCCESS;
+ // 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;
+ }
- std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0);
+ const ModuleManager::ModuleMap& mods = ServerInstance->Modules->GetModules();
- for (unsigned int i = 0; i < module_names.size(); i++)
+ for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
{
- Module* m = ServerInstance->Modules->Find(module_names[i]);
+ Module* m = i->second;
Version V = m->GetVersion();
if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"))
@@ -76,17 +89,17 @@ CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, Us
#ifdef PURE_STATIC
user->SendText(":%s 702 %s :%p %s %s :%s", ServerInstance->Config->ServerName.c_str(),
- user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str());
+ user->nick.c_str(), (void*)m, m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str());
#else
std::string srcrev = m->ModuleDLLManager->GetVersion();
user->SendText(":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName.c_str(),
- user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), srcrev.c_str());
+ user->nick.c_str(), (void*)m, m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str(), srcrev.c_str());
#endif
}
else
{
user->SendText(":%s 702 %s :%s %s", ServerInstance->Config->ServerName.c_str(),
- user->nick.c_str(), module_names[i].c_str(), V.description.c_str());
+ user->nick.c_str(), m->ModuleSourceFile.c_str(), V.description.c_str());
}
}
user->SendText(":%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName.c_str(), user->nick.c_str());