]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_commands.cpp
m_spanningtree Rewrite /map
[user/henk/code/inspircd.git] / src / commands / cmd_commands.cpp
index 13bd3fab8d5b3eec9e396dc4e648eb1f79483289..c456160612a57a5f70bc9ec73bd025a8ec91b91b 100644 (file)
@@ -30,7 +30,11 @@ class CommandCommands : public Command
  public:
        /** Constructor for commands.
         */
-       CommandCommands ( Module* parent) : Command(parent,"COMMANDS",0,0) { }
+       CommandCommands(Module* parent) : Command(parent,"COMMANDS",0,0)
+       {
+               Penalty = 3;
+       }
+
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
@@ -48,18 +52,19 @@ CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
        list.reserve(ServerInstance->Parser->cmdlist.size());
        for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
        {
+               // Don't show S2S commands to users
+               if (i->second->flags_needed == FLAG_SERVERONLY)
+                       continue;
+
                Module* src = i->second->creator;
-               char buffer[MAXBUF];
-               snprintf(buffer, MAXBUF, ":%s %03d %s :%s %s %d %d",
-                       ServerInstance->Config->ServerName.c_str(), RPL_COMMANDS, user->nick.c_str(),
-                       i->second->name.c_str(), src->ModuleSourceFile.c_str(),
-                       i->second->min_params, i->second->Penalty);
-               list.push_back(buffer);
+               list.push_back(InspIRCd::Format(":%s %03d %s :%s %s %d %d", ServerInstance->Config->ServerName.c_str(),
+                       RPL_COMMANDS, user->nick.c_str(), i->second->name.c_str(), src->ModuleSourceFile.c_str(),
+                       i->second->min_params, i->second->Penalty));
        }
        sort(list.begin(), list.end());
        for(unsigned int i=0; i < list.size(); i++)
                user->Write(list[i]);
-       user->WriteNumeric(RPL_COMMANDSEND, "%s :End of COMMANDS list",user->nick.c_str());
+       user->WriteNumeric(RPL_COMMANDSEND, ":End of COMMANDS list");
        return CMD_SUCCESS;
 }