diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-06-13 15:40:03 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-06-13 15:40:03 +0200 |
commit | 085a8a34cb0b1bd97bba76fff15820fb57aa50e4 (patch) | |
tree | edbbb57fa80ac5da15b8c41e9c85976c4ff2414b /src/coremods | |
parent | 7f878af39e659176677913890e143a247add7bdc (diff) |
Add CommandParser::GetCommands() and typedef CommandMap and use it instead of directly accessing cmdlist
Diffstat (limited to 'src/coremods')
-rw-r--r-- | src/coremods/core_info/cmd_commands.cpp | 5 | ||||
-rw-r--r-- | src/coremods/core_stats.cpp | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/coremods/core_info/cmd_commands.cpp b/src/coremods/core_info/cmd_commands.cpp index 9ae258a9c..8b255a928 100644 --- a/src/coremods/core_info/cmd_commands.cpp +++ b/src/coremods/core_info/cmd_commands.cpp @@ -31,9 +31,10 @@ CommandCommands::CommandCommands(Module* parent) */ CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user) { + const CommandParser::CommandMap& commands = ServerInstance->Parser->GetCommands(); 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++) + list.reserve(commands.size()); + for (CommandParser::CommandMap::const_iterator i = commands.begin(); i != commands.end(); ++i) { // Don't show S2S commands to users if (i->second->flags_needed == FLAG_SERVERONLY) diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index b8ea21731..1e90ed2bf 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -189,7 +189,9 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) /* stats m (list number of times each command has been used, plus bytecount) */ case 'm': - for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++) + { + const CommandParser::CommandMap& commands = ServerInstance->Parser->GetCommands(); + for (CommandParser::CommandMap::const_iterator i = commands.begin(); i != commands.end(); ++i) { if (i->second->use_count) { @@ -197,6 +199,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) results.push_back("212 "+user->nick+" "+i->second->name+" "+ConvToStr(i->second->use_count)); } } + } break; /* stats z (debug and memory info) */ @@ -204,7 +207,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) { results.push_back("249 "+user->nick+" :Users: "+ConvToStr(ServerInstance->Users->GetUsers().size())); results.push_back("249 "+user->nick+" :Channels: "+ConvToStr(ServerInstance->GetChans().size())); - results.push_back("249 "+user->nick+" :Commands: "+ConvToStr(ServerInstance->Parser->cmdlist.size())); + results.push_back("249 "+user->nick+" :Commands: "+ConvToStr(ServerInstance->Parser->GetCommands().size())); float kbitpersec_in, kbitpersec_out, kbitpersec_total; char kbitpersec_in_s[30], kbitpersec_out_s[30], kbitpersec_total_s[30]; |