From 6f914e2dd80375fa9809619c21a09705e4d24129 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 3 Feb 2010 19:12:04 +0000 Subject: Fix cidr_mask::str not correctly displaying mask length git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12363 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands/cmd_commands.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/commands/cmd_commands.cpp') diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp index 5a047e4a7..4b1e3e9be 100644 --- a/src/commands/cmd_commands.cpp +++ b/src/commands/cmd_commands.cpp @@ -48,16 +48,21 @@ class CommandCommands : public Command */ CmdResult CommandCommands::Handle (const std::vector&, User *user) { + std::vector list; + list.reserve(ServerInstance->Parser->cmdlist.size()); for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++) { Module* src = i->second->creator; - user->WriteNumeric(RPL_COMMANDS, "%s :%s %s %d %d", - user->nick.c_str(), - i->second->name.c_str(), - src ? src->ModuleSourceFile.c_str() : "", - i->second->min_params, - i->second->Penalty); + 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); } + 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()); return CMD_SUCCESS; } -- cgit v1.2.3