]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_modules.cpp
m_spanningtree Rewrite /map
[user/henk/code/inspircd.git] / src / commands / cmd_modules.cpp
index c37008563c4304306284f1169667407a9a637050..d9fa7d5d5642f60779e3388513b91679e7fdd390 100644 (file)
@@ -31,7 +31,12 @@ class CommandModules : public Command
  public:
        /** Constructor for modules.
         */
-       CommandModules ( Module* parent) : Command(parent,"MODULES",0,0) { syntax = "[server]"; }
+       CommandModules(Module* parent) : Command(parent,"MODULES",0,0)
+       {
+               Penalty = 4;
+               syntax = "[<servername>]";
+       }
+
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
@@ -49,8 +54,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)
@@ -58,7 +79,7 @@ CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
                Module* m = i->second;
                Version V = m->GetVersion();
 
-               if (user->HasPrivPermission("servers/auspex"))
+               if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"))
                {
                        std::string flags("SvcC");
                        int pos = 0;