summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-03 19:12:04 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-03 19:12:04 +0000
commit6f914e2dd80375fa9809619c21a09705e4d24129 (patch)
tree6dfa91d7becf3a1db52df30db82a9103cf249397
parentc85a6bea77568739df592a90fba5ddf56cb5cf04 (diff)
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
-rw-r--r--src/commands/cmd_commands.cpp17
-rw-r--r--src/socket.cpp2
2 files changed, 12 insertions, 7 deletions
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<std::string>&, User *user)
{
+ std::vector<std::string> 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() : "<core>",
- 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;
}
diff --git a/src/socket.cpp b/src/socket.cpp
index 0ceb40330..63b373cce 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -331,7 +331,7 @@ std::string irc::sockets::cidr_mask::str() const
else
return "";
memcpy(base, bits, len);
- return sa.addr() + "/" + ConvToStr(length);
+ return sa.addr() + "/" + ConvToStr((int)length);
}
bool irc::sockets::cidr_mask::operator==(const cidr_mask& other) const